I am certain that the below index match with multiple criteria should work but for some reason it isn't. A few things about the data in B1:H1 and K1, they are dynamic values, that is, they aren't "dates" so to speak. B1 has a value of =TODAY()+2-WEEKDAY(TODAY()) and K1 has a value of =TODAY().
I can't convert it to a table as I need the headers to be dynamic.
Please help, thanks.
Looks like a vlookup + a match works. If you guys figure out why the index match works on atable and let me know that would be great!
=VLOOKUP(K2, $A$1:$H$15, MATCH($K$1, $A$1:$H$1,0), FALSE)
Try one match to column A and another completely separate match to row 1. In other words, one match for the row number and another for the column number.,
=index(a$1:h$15, match(k2, a:a, 0), match(k$1, $1:$1, 0))
Fill down for the other row-by-column matches.
Related
I have a column which is a dynamic named range:
A
A
B
C
A
How can I apply a MATCH or other formula which returns the row or cell address of all A values in the dynamic named range?
A dynamic named range is used so all row or address of A values can automatically appear as a spill rather than having to drag down the formula.
I have seen numerous formulas in this structure:
=INDEX($B$2:$B$8, SMALL(IF($A$11=$A$2:$A$8, ROW($A$2:$A$8)-ROW($A$2)+1), ROW(1:1)))
However, most of these seem to return the first instance (row or cell address of the first match) and requires the formula to be dragged down manually rather than a spill, which is more preferable.
Any help will be greatly appreciated.
Use FILTER:
=FILTER(ROW(A1:A5),A1:A5=C1)
This will return the Row number everywhere they match.
From there it is pretty easy to include that in INDEX:
=INDEX(B:B,FILTER(ROW(A1:A5),A1:A5=C1))
If you do the full column in the index, you do not need the ROW($A$2:$A$8)-ROW($A$2)+1 as returning the actual row instead of relative works just fine.
Try something like =SORT(ROW($A$1:$A$5)/($A$1:$A$5=$C$1)). This will get you the matches of a value in C1 with a spill formula, leaving behind #DIV/0 errors
See example below:
Other answers that you might be able to take ideas from are here: Match Exact Row Number of Nth Largest Value In Data With Duplicates
You could be thinking of:
=SMALL(IFERROR(ROW(A1:A5)*MATCH(A1:A5,C1,0),FALSE),ROW(A1:INDEX(A:A,COUNTIF(A1:A5,C1),)))
Where your data start in A1 and your compare value is in C1.
If you have Excel 365, this is easier:
=INDEX(SORT(ROW(A1:A5)*MATCH(A1:A5,C1,0)),SEQUENCE(COUNTIF(A1:A5,C1)))
or better yet:
=LET( dataRange, A1:A5,
compareTo, C1,
INDEX(SORT(ROW(dataRange)*MATCH(dataRange,compareTo,0)),SEQUENCE(COUNTIF(dataRange,compareTo))) )
I have a workbook where the lookup value is a concatenate of the row and column of a table. I understand how to index match, but can't figure out how to make it match the lookup value to the correct concatenate.
I would need to take whatever the look up is, find the concatenate in the table and spit out the matching value. Is there a way to do this?
Thanks in advance.
try,
=index(b2:f6, match(--left(i3), a2:a6, 0), match(right(i3), b1:f1, 0))
I'm having an issue with INDEX + MATCH combination:
=INDEX(ALL!$C$1:$I$1,MATCH(TRUE,ALL!C2:I2<>0,0))
At the moment the aforementioned formula does this job to an extent, where if it finds <>0 value in a row it will return header from this specific column. The issue is that the ROW (as above C2:I2) needs to be specified.
I need to vlookup values in the column "A" in sheet "ALL" and based on that, look at corresponding rows between C:I and if the value in that specific row is <>0 then return heading value.
So, in green I would need a formula to pick up numbers from "Data Source" headings, based on value 1 or any value <>0. I'm guessing it all leads somehow to some sort of "vlookup" hybrid.
Any ideas how to combine vlookup in it?
Thanks
If there can only be one '1' per row, I was thinking of this
=SUMIF(INDEX(B:E,MATCH(G2,A:A,0),0),">0",$B$1:$E$1)
Otherwise if there can be more than one '1'
=INDEX($B$1:$E$1,MATCH(TRUE,INDEX(B:E,MATCH(G2,A:A,0),0)>0,0))
to match the first value greater than zero, in this case entered as an array formula.
A simple =SUMIF() formula will do, no other convoluted INDEX() and MATCH() nested formulas required.
Let's presume we have a data-table that starts at B2 and end at
F6, like this:
So now, to comprehend the solution, here's the syntax of SUMIF() formula (Function):
=SUMIF( range, criteria, [sum_range] )
So, what we want to do is:
go over the range of C3:F3 (and each other respective row)
the criteria to when to sum, is when this range contains 1
and we want to sum_range (sum up) fixed array of numbers, so $C$2:$F$2
So the result is (for row 3):
=SUMIF(C3:F3,1,$C$2:$F$2)
and we drag the formula down, producing expected result:
PS: I think this illustrates the point very well, as to why it's important to declare not only what your formula is doing but also, what you're trying to as in whole as there often is a better (easier) way to implement something, that you might not have thought of.
In other words, follow the Minimal, Complete and Verifiable Example
I have this:
My issue:
in column F2 I want R2 -> IF -> B2+C2+D2 exists in O:O;P:P;Q:Q
but I do not know how to use VLOOKUP with multiple columns
my attemp was '=VLOOKUP(B2;O:O;4;FALSE)' and I do not know why I used 4... cuz I count R2 as index 4 from O2...
This is just a multiple column lookup. While two column lookups are more common, three column lookups are not that rare.
=index(r:r, aggregate(15, 6, row($2:$999)/((o$2:o$999=b2)*(p$2:p$999=c2)*(q$2:q$999=d2)), 1))
That will return the value from column R for the first matching set of columns O:Q. In the case of multiple matches, you could return the last match by changing 15 to 14.
Since your returned results are expected to be numeric, a sumifs could also be used.
=sumifs(r:r, o:o, b2, p:p, c2, q:q, d2)
However this would return skewed results is more than a single match was found.
In your own vlookup, the 4 represents the fourth column of your lookup range. Since you were only providing a single column (e.g. O:O), you would never return the value from column R without changing the lookup range to O:R.
Another approach (since they look like dates DD/MM/YYYY) would be to convert each group of three columns to dates
=INDEX(R:R,MATCH(DATE(D2,C2,B2),INDEX(DATE(Q:Q,P:P,O:O),0),0))
#Jeeped is right to point out that this is slow on full columns, so plz use a formula like
=INDEX(R$1:R$100,MATCH(DATE(D2,C2,B2),INDEX(DATE(Q$1:Q$100,P$1:P$100,O$1:O$100),0),0))
and adjust the ranges to include your data.
If O:O;P:P;Q:Q is unique, you can use:
=lookup(1,0/((O:O=B2)*(P:P=C2)*(Q:Q=D2), R:R)
I am trying to lookup a table in one of my sheets. my table consists of three columns and an unlimited amount of rows.
My table can be seen here:
In my second sheet I wish to write a formula which searches all rows in the table and looks for an exact match in column A and column B, this means it must find the row where column a has a value of "jan" and in that same row the second column must have value "y". Should it find this match, it should return the value of column C.
I tried researching hlookup but that is for horizontal tables so i dont believe this would work. I looked into Vlookups also but that only allows one criteria search instead of looking for two matches.
Can anyone shed some light here please?
You can use index and match with multiple criteria
=INDEX($A$1:$C$1000, MATCH("Jan"&"y", $A$1:$A$1000&$B$1:$B$1000, 0),3)
press CTRL + SHIFT + ENTER when entering this formula.
Convert the range to a table (ctrl-t) and then use SUMIFS to search the table based on two criteria
=SUMIFS(Table1[Alteration],Table1[Month],"Jan",Table1[Products],"y")
This is saying "give me [Alteration] where [Month] = "Jan" and [Products] = 'y'...this returns 364.
You can point the criteria at separate cells containing your criteria.
Be aware that if there is more than one row with identical data (ie more than one row with both 'Jan' and 'y'), column C will be summed together.
The INDEX function has the syntax
INDEX(array, row_num_in_array, [column_num_in_array])
And MATCH returns in the index location of a logic match
MATCH(lookup_value, lookup_array, [match_type])
Combining the two is a flexible technique, and surprisingly powerful -- the logic in a match lookup_value can be a complex condition.
SIMPLEST CODE
Operate on the whole column
INDEX(C:C, MATCH("Jan"&"y", A:A&B:B, 0), 1)
nb./ A:A is excel code for "all of column A". You can instead use:
RESTRICTED CODE
Operates on a subset of the sheet.
INDEX($C$2:$C$1000, MATCH("Jan"&"y", $A$2:$A$1000&$B$2:$B$1000, 0), 1)
Note that you MUST use identical row length arrays (eg. rows 2:1000) or the formula will not work. MATCH only knows how many rows into its lookup_array it got, you need to ensure its rows match those in INDEX's array
PS. apologies this is close to the previous answer, but the details were too long for a comment.
PPS. I missed the clarifications to the first answer. That will work, but there is no need to use all three columns as the array in the INDEX function. You are only returning data from column C after all.