I have a formula that lookup data for a particular date and an ID.
My issue is some cells have multiple IDs. So I'm trying to find a way to look for a partial match within my formula.
Below is the formula I'm currently using.
=MAP(B2:B,C2:C,LAMBDA(bx,cx,IF(bx="",,IFNA(FILTER(FILTER(Data!B:G,EOMONTH(Data!B1:G1,0)=EOMONTH(INT(LEFT(cx,7)),0)),Data!A:A=bx)))))
I'm guessing the last part is the one that need to be changed ->
Data!A:A=bx
I usually use the below trick to get an approximate match, but it does not work in this case.
"*"Data!A:A"*" or "*"&Data!A:A&"*"
here is my sample for file to better undesrtand my issue:
https://docs.google.com/spreadsheets/d/1BxZYj5CTUuOjcVBeDC_v6nlizoPakNHRTpAZgrOahEw/edit#gid=0
You can try with REGEXMATCH to find the text no matter its location:
=MAP(B2:B,C2:C,LAMBDA(bx,cx,IF(bx="",,IFNA(FILTER(FILTER(Data!B:G,EOMONTH(Data!B1:G1,0)=EOMONTH(INT(LEFT(cx,7)),0)), REGEXMATCH (Data!A:A,bx))))))
Related
I am currently working on a dataset that includes several columns, mostly the dates. What I am trying to achieve is - unpivot all the date columns to use for my subsequent calculations. I use the following formula to unpivot: =ARRAYFORMULA(SPLIT(FLATTEN(Data!A2:A&"|"&Data!D1:AG1&"|"&Data!D2:AG),"|"))
Even though this returns the expected result, when I try to nest this within a Query function, it does not work correctly. This is how I applied the formula - QUERY(ARRAYFORMULA(SPLIT(FLATTEN(Data!A2:A&"|"&Data!D1:AG1&"|"&Data!D2:AG),"|")),"Select * WHERE Col3 IS NOT NULL")
PS: When I change the data range to say, A2:A100, it gives me the correct result. However, it does not help since lot of new data would get added and I want the formula to be dynamic.
Here's the link to the sample sheet - https://docs.google.com/spreadsheets/d/1dgFY5mT9nUJtFefjAros-XpWXRMFtxEf8Fqrv82N5Ys/edit#gid=1813140523
Any help/suggestions would be highly appreciated
Not sure where you got your SPLIT(FLATTEN technique,
but you have to include both the 3rd and 4th parameters of the split function as FALSE or 0. so in your case it would be:
=ARRAYFORMULA(SPLIT(FLATTEN(Data!A2:A&"|"&Data!D1:AG1&"|"&Data!D2:AG),"|",0,0))
If you do that you'll find your query works.
Also note that the way you have it it's not really working. If you look all the way down in column 1 you'll find a bunch of dates formatted to look like integers.
I am very fresh with Excel and still learning the basics. I came upon an issue I really need help with and couldn't find suitable solution online.
I have a column I keep on constantly updating with Bulk data THE COLUMN.
I'd like to see the most common entry and the least common entry for a specific time using this formula:
=INDEX('Data Input'!F433:F610,MODE(MATCH('Data Input'!F433:F610,'Data Input'!F433:F610,0)))
But once I try it, it constantly tells me:
Did not find value '' in MATCH evaluation.
I've tried with shorter ranges and It did work, so I guess once it runs through empty cell - it breaks. How can I modify this formula to function properly and print what I need?
And side question, is is possible to implement a calendar bar and choose between dates?
You can insert a clause to exclude blanks (assuming they are not to be considered a legitimate return):
=INDEX('Data Input'!F433:F610,MODE(IF('Data Input'!F433:F610<>"",MATCH('Data Input'!F433:F610,'Data Input'!F433:F610,{0,0}))))
Note that I have used
{0,0}
for MATCH's match_type parameter so that the formula will not error should there be more than one entry within your range which shares the highest frequency. In such cases, the above formula will return that which occurs first in your list.
Here's what I'm trying to do: I have a list of courses in Google sheets to which items will be added daily by pasting them at the end of the current list. I then want to check if a course has already been added to the list before. If that is the case, the value of a certain column will get the value that the first occurrence of that course has. So I will be using =INDEX(MATCH... and the range in the match part will be all the cells in the column above the cell that is checked. The MATCH part of the formula is obvious if you drag or copy the formula downwards:
= MATCH(A2; A$1:A2; 0)
However I was experimenting with other ways of achieving this, namely
MATCH(A2; "A$1:A"&ROW()-1; 0)
(I also tried this one without the quotation marks) and
MATCH(A2; (ADDRESS(1;1;2)&":"&ADDRESS(ROW()-1;1; 4)); 0)
Both of these don't work. I can't figure out why. (BTW, the semicolon is ok where I live). I get #N/A everywhere and the message that the value has not been found in the match evaluation.
Any thoughts on what I am doing wrong? Also: if I would get this to work, are there any advantages or disadvantages over copying the simple formula all the way downwards? Thank you very much in advance.
Here's an ArrayFormula approach so you only need a single formula
=ArrayFormula(IFNA(IF(MATCH(A2:A,A2:A,0)<>ROW(A2:A)-ROW()+1,A2:A,"N/A")))
It is because second parameter of MATCH function requires range, but you in both cases pass the string. I don't know why you don't like the first option, but you may be able to use the OFFSET function.
=INDEX(A:A;MATCH(A2; OFFSET($A$1;0;0;ROW()-1); 0))
I want to create a formula, that gets me the specific value(s) from row in another table. The formula I've created
=LOOKUP(E5;Ingredients!$A$6:$B$49;Ingredients!$F$6:$F$49)
gives me false results. But when I sort the values by alphabet the results are correct.
Is there some way to create a formula that is not dependent on alphabetical sort of source table?
From https://support.google.com/docs/answer/3256570?hl=en-GB
"Notes:
The LOOKUP function will only work properly if data in search_range or search_result_array is sorted. Use VLOOKUP, HLOOKUP or other related functions if data is not sorted."
Personally, I've never really used the lookup functions because of issues like this, so I'm a bit rusty on the specifics of how they all work. My go-to is the INDEX MATCH solution, which might be something like
=index(Ingredients!$F$6:$F49, match(E5, Ingredients!$A$6:A$49))
What I'm also not sure about is how Lookup is supposed to work when you're giving it more than one column as the input, though; you're giving it A and B - I thought that syntax was for an array where the output comes from the last column, and I don't know what happens if you then specify the output column as well, as you've done.
Problem
I have a column with duplicate items in Google Sheets, and I would like to get one of the unique values (say, the last one) in the cell of the formula. Is there a way to do this with just formulas (i.e., no scripts/macros)?
What I've tried
Not sure if this is the best way, but I've tried using the UNIQUE(range) function, which returns a list of distinct values, and I tried to pick one with FILTER(range, condition1, [condition2, …]), but I've only managed to do it when I know in advance and hard-code in the number of unique values.
Since I can get the length of the unique list with =LEN(UNIQUE(my_range)), I tried using the REPT(text_to_repeat, number_of_repetitions) function.
For example,
=REPT(0&";",2) & 1 returns "0;0;1"
but
=FILTER(UNIQUE(A$1:A$26), {REPT(0&";",2) & 1})
(or any variation I tried) doesn't quite work.
P.S.
I realise this is not the most suitable problem for a spreadsheet, and I do wish I was using something like Python, but this is the restriction at the moment.
try:
=QUERY(UNIQUE(A1:A), "offset "&COUNTA(UNIQUE(A1:A))-1)
Or more old-school using index:
=index(unique(A:A),counta(unique(A:A)))
You can also just enter a number fot the one you want e.g.
=index(unique(A:A),2)