This is the example sheet. I'm trying to make it so I can put an age in Age!A2:A and then in Age!B2:B, the formula puts in the age range label that's pulled from the sheet dv.
Right now, in cell Age!B1, is the formula ={"Age Range";ARRAYFORMULA(IF(A2:A<>"",QUERY(dv!1:5,"select C where A <= "&A2:A&" and B > "&A2:A&""),""))}. However, while it'll populate when an age is put in, it only spits out "Child".
I think you just need a regular vlookup (,... TRUE) type formula. See the mk.help tab.
={"Age Range";ARRAYFORMULA(IF(A2:A<>"",VLOOKUP(A2:A,dv!A:C,3),))}
Related
Column A is named "Quantity", which works in a simple formula:
I'm getting an error when attempting to use a named range in ISBETWEEN formula:
I verified that ISBETWEEN works when I use cell reference A2 instead of named range Quantity:
Any thoughts how I can fix? 😤
Your named range Quantity has its range set to A1:A but you are entering it in row 2, so error says there is no room in A2:A for A1:A unless you add a row but when you do it's the same coz you can't fit 3 keys into 2 keyholes (from one side each of course)
As seen on this sample:
See my comment to your original post.
Assuming that your named range Quantity is applied to the entire range A:A (and not A2:A), delete everything from Col B (including the header) and then place the following formula in cell B1:
=ArrayFormula( {"Test"; IF(A2:A="",, ISBETWEEN( FILTER(Quantity, ROW(Quantity)>1), 1, 5) ) } )
This one formula will create the header text (which you can change within the formula if you like) and all results for all valid, non-null rows.
FILTER(Quantity, ROW(Quantity)>1) is necessary to limit the full range of the named range Quantity to only those elements whose row is greater than (row) 1; this is because your results begin in Row 2.
You only need this one formula. As you add more data into Col A, the formula will process it.
Within a google sheet, on tab 2 I have column A of dates and column B of words. On tab 1, I have a date range in two cells. I am trying to populate the cell if column A falls within the date range of tab 1 and also has the specified word.
Variables to check
Date cells
Using COUNTIFS:
=COUNTIFS(Sheet2!B2:B,"toured",Sheet2!A2:A,">="&A2,Sheet2!A2:A,"<="&A3)
Using QUERY:
=QUERY(Sheet2!A2:B,"SELECT COUNT(A) WHERE B='toured' AND A >= date '"&TEXT(A2,"yyyy-MM-dd")&"' AND A <= date '"&TEXT(A3,"yyyy-MM-dd")&"' label COUNT(A) ''")
Note:
In the spreadsheet you shared, somehow the toured in cell B4 is not getting detected as such, resulting in the returned value being 2. Please rewrite toured in that cell in order to make sure 3 is returned.
Reference:
COUNTIFS
QUERY
In this sheet,
https://docs.google.com/spreadsheets/d/1MR0n1FoutASbuwiNJS7FrcQhxHF6Bo03oVs9RZPo9g4/edit?usp=sharing
I am trying to have column B be populated with cell values equal to is today's date or tomorrow's date, by referencing column F.
Then, I am trying to have column A be populated with the contents of column E, based on if the column E's item is for today or tomorrow (Basically if the item's corresponding date shows up in B).
I've tried playing with index, lookup and filter but I cannot manage to get the formula right, and when using index and lookup there are many empty cells in between the dates.
I would appreciate any help.
I added a sheet ("Erik Help") with the following formula in A1:
=ArrayFormula(IFERROR(FILTER(E:F,(F:F=TODAY())+(F:F=TODAY()+1))))
That one formula returns all results you wanted to see.
Explanation:
The key part to understand is the condition that FILTER is using to filter in entries; and that is (...) + (...). The plus sign is the equivalent of OR in an array. So it's basically saying, "Filter in all results from E:F where (F:F = today) OR (F:F = tomorrow)." And if there is no match at all found for that OR condition, IFERROR will just return nothing (rather than an error).
Reference:
FILTER
I'm learning basic =ARRAYFORMULA usage for a finance spreadsheet:
https://docs.google.com/spreadsheets/d/12cAGuUBzIo0LPbmtqWJZNFgjt94f1ybGoj6x2g0c2Y0/edit?usp=sharing
First, I used =GOOGLEFINANCE at B1 to pull up stock prices for a given date range in Column C
=GOOGLEFINANCE(A1,"price",DATE(2020,1,1),DATE(2020,5,30),"DAILY")
Then, I used simple arithmetic to multiply by number of shares at D2 and dragged the formulas down to get a nice column of values
=C2*20
Then, I used INDEX and COUNTA to pull out the last value of Column D at F3 === Great!
=INDEX(AAPL!D2:D,COUNTA(AAPL!D2:D),1)
Next, I turned my arithmetic formula into an ARRAYFORMULA at G2 === Cool!
=ARRAYFORMULA(C2:C103*20)
Of course, the problem with that ARRAYFORMULA is that I would have to manually change the array name in G2 every time the date range updated.
That is, instead of C2:C103, I would need to change the reference to C2:104 to get the columns to match === Rookie mistake!!!!!
So, I got smart with an ARRAYFORMULA containing a IF(ISBLANK(),...,...) at J2
=ARRAYFORMULA(IF(ISBLANK(B2:B),"",C2:C*20))
Column J stays fully populated with the correct values for any date range === !!!!!!!
But now the =INDEX(AAPL!J2:J,COUNTA(AAPL!J2:J),1) at L3 can't find the last value in Column J
Whaaat???
I've tried everything I can think of
It works if I use =INDEX(AAPL!J2:J104,COUNTA(AAPL!J2:J104),1) but that would defeat the purpose, since the reference J:J104 is going to change as the dates change
WHY???
I get the same results in both cells "L3" and "L5" when using:
=ARRAYFORMULA(IF(ISBLANK(B2:B),,C2:C*20))
Check that you are not returning a blank string ("") in your IF like: "=ARRAYFORMULA(IF(ISBLANK(B2:B),"",C2:C*20))" doing so will fill the cells up to the last row in the sheet with empty strings, thus when you use COUNTA(AAPL!J2:J),1) you get a lot more cells than you would expect, these extra cells are the ones you filled with blank strings in the array formula.
On the contrary when you limit the =INDEX(AAPL!J2:J104,COUNTA(AAPL!J2:J104),1) to cells with numbers only it doesn't mix strings and numbers in the calculation and you are naturally get the expected results.
in col A I have a list of email addresses
in col B I want to catch duplicates, so if an email address in A appeared before I get a trigger in B.
I'm using this formula which works great:
=if(isna(match(a3,$A$2:A2,0)),"New","Duplicate")
note that as I drag this formula, $A$2 stays so the range grows (e.g. for cell B51 the range will be from $A$2:A50)
My problem is that since column A updates automatically (e.g. new email addresses are added) I want column B to update automatically as well. I tried using Arrayformula but can't figure it out :(
I tried both:
=arrayformula(if(isna(match(A3:A,$A$2:A2,0)),"New","Duplicate"))
and
=arrayformula(if(isna(match(A3:A,$A$2:A2:A,0)),"New","Duplicate"))
but they don't work.
here's a spreadsheet with an example and my (failing) attempts to solve it
https://docs.google.com/spreadsheets/d/1N3pFPnT452FmWa9w8EkYpIq-ZnivjoCzt5ORrNEKgLQ/edit#gid=0
Please, try:
=ArrayFormula(IFERROR(if(VLOOKUP(A2:A,{A2:A,ROW(A2:A)},2,)=ROW(A2:A), "New", "Duplicate")))
If matching row = current row → "New", else → "Duplicate".
I used vlookup because it may be used with ArrayFormula
You can do it using Match to see if the first match for the current email address is before the current row of the array
=arrayformula(if(match(A2:index(A2:A,COUNTA(A2:A)),A2:index(A2:A,COUNTA(A2:A)),0)<row(A2:index(A2:A,COUNTA(A2:A)))-1,"Duplicate","New"))
You can also do a countif that looks at everything above the current row:
=IF(countif($A$1:A2,A2)>1,"DUPLICATE","NEW")