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))
Related
On Sheet2 I am trying to sum the values in a row of a range on Sheet1 over a dynamic range of columns based on a lookup value for the from column and a fixed variable for how many columns to right of that lookup value for the to column.
I am using INDEX-MATCH to find the from cell based on certain reference, INDEX-MATCH with a reference added to the column lookup to find the to column, and CELL to get the position rather than value of the results.
What I have is the following:
=SUM(
CELL("address",
INDEX(Sheet1!$B$4:$BA$36,MATCH($A$1,Sheet1!$A$4:$A$36),MATCH(D$3,Sheet1!$B$3:$BA$3,0)))
&":"&
CELL("address",
INDEX(Sheet1!$B$4:$BA$36,MATCH($A$1,Sheet1!$A$4:$A$36),MATCH(D$3,Sheet1!$B$3:$BA$3,0)+'Control Panel'!$C$2)))
Control Panel!$C$2 is my variable for how many columns to the right of the from column I want the to column to be.
Obviously, this is not working. I suspect it's because the concatenated text in the SUM() reference the full file name rather than 'Sheet1'![from]:[to]. Not sure if this is the case, but also can't figure out how to get just the A1 cell position for the to.
Any ideas how I can get this to work?
Figured it out:
=SUM(INDEX(Sheet1!$B$4:$BA$36,MATCH($A$1,Sheet1!$A$4:$A$36),MATCH(D$3,Sheet1!$B$3:$BA$3,0))):INDEX(Sheet1!$B$4:$BA$36,MATCH($A$1,Sheet1!$A$4:$A$36),MATCH(D$3,Sheet1!$B$3:$BA$3,0)+'Control Panel'!$C$2))
Literally just needed a colon between the two index-matches. Still not sure why this works, as the index-match should return a value.
I am attempting to Index and Match and find the green value labeled in my table below based on the criteria in the yellow cells. Any idea how to go about this, here is my current formula:
INDEX($A$2:$F$31, MATCH($H$3,$B$2:$B$31,0), MATCH($H$4, $C$2:$C$31,0))
It keeps returning the "Type" and not the "Cats" value I would like to have, 0.1518. Would Vlookup + Match be easier? Any help would be greatly appreciated.
Basically, I am trying to match two row variables (City and Type) with the column variable (cats) to get the value. However, if I use vlookup then maybe I can just say go to the cat column instead of matching it with another cell.
Try this formula:
=INDEX(E2:E31,MATCH(1,INDEX((H3=B2:B31)*(H4=C2:C31),0,1),0))
Based on the non-array version of the formula found here: https://exceljet.net/formula/index-and-match-with-multiple-criteria
I know that I can use [#col1] to refer to the cell within col1 that is on the same row as the formula. But is there a way to refer to the cell that is on the row above? Maybe something like: [#col1 - 1] (hypothetical)
Try
=INDEX([col2],ROW()-2)
In the first table row, the formula will return a 'wrong' value, i.e. the value of the same row, but in the next row it will show correctly.
If you want to calculate a running total, you can use something along the lines of
=SUM([#col1],INDEX(C:C,ROW()-1))
Note how the reference for Index is the whole column. Using Sum() will ignore text, so the formula will not return an error when the column title is involved.
Not sure there is a built in way, but you can always index match. Something like
=INDEX(A:A, MATCH([#Col1],A:A, 0)-1)
Change the A:A to whatever column you want to reference and -1 for one row up, -2 for two rows up, and so on.
This gives you distance of the row you're on from the header row, and handles the first row with no problem.
=(ROW() - ROW([#Headers])-1)
Easy to adapt for use with OFFSET or INDEX to give you the previous row.
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.
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.