How to use index and match concept to retrieve values from 2nd row and 3rd column or 1st row and 4th column and so on - excel

Jan Feb Mar Apr May
1 10 110 101 11 90
2 20 111 102 12 91
3 30 112 103 13 92
4 40 113 104 14 93
5 50 114 105 15 94
How to use index and match concept to retrieve values from 2nd row and 3rd column or 1st row and 4th column and so on

If you wanted to match cell $B$2 (Row 2, Column "February") you could use the following formula:
INDEX(B1:B5, MATCH(91, E1:E5, 0))
This would give the value 111, which is the value of $B$2
The INDEX function in Excel takes a range (B1:B5) and an index into that range, and returns the value. In an INDEX MATCH, the index used is actually a call to the MATCH function. Here, I obtained an index of 2 when MATCHing the value 91 in the range E1:E5.
In English you might read this call as saying "Find the value in the range B1 to B5 whose index is the same as the value 91 in the range E1 to E5."

If the months are in B1:F1, row labels in A2:A6 and main body of the table in B2:F6 then you can get the value at the intersection of the nth row and kth column of B2:F6 using this formula
=INDEX(B2:F6,n,k)
As per Tim's answer you can derive the n and k values using MATCH functions based on the values in the column headers and row labels, e.g. matching "Apr" and 4 will give you the value at the intersection, i.e. 14
and the formula would look like this
=INDEX(B2:F6,MATCH(4,A2:A6,0),MATCH("feb",B1:F1,0))
see here for more

Related

Excel Index Match Formula last change

I've got a column U and a column L.
What I need to get is the value from column L when searched in column U.
Column L Column U
516 11
123 11
74 5
46 11
748 21
156 11
189 21
187 21
For example:
I want to search 21 in column U but I need to find the first value from the last change
(the number stays the same further in the column).
So if I want the value belonging to 21 I need to get 189.
I tried it with (thanks to Scott Craner):
=INDEX($L:$L,AGGREGATE(14,6,ROW($U$10:$U$500)/($U$10:$U$500=D2),1))
But this gets me the last 21 value so 187 as answer.
Does anybody know how to solve this?
You need to find the last row in column U with the value from D2 where the row immediately above it is not the same value.
=INDEX(L:L, AGGREGATE(14,6,ROW(U$10:U$500)/((U$10:U$500=D2)*(U$9:U$499<>D2)),1))
Now change U15 to be another 21. The result becomes,
For a dynamic number of values in columns L and U (starting in row 10), use,
=INDEX(L:L, AGGREGATE(14,6,ROW(U$10:INDEX(U:U, MATCH(1E+99, U:U)))/((U$10:INDEX(U:U, MATCH(1E+99, U:U))=D2)*(U$9:INDEX(U:U, MATCH(1E+99, U:U)-1)<>D2)),1))
If I understand you correctly, I believe this accomplishes the task:
=INDEX($L:$L,MATCH(INDEX($L:$L,AGGREGATE(14,6,ROW($U$9:INDIRECT("$U$"&MATCH(INDEX($L:$L,AGGREGATE(14,6,ROW($U$10:$U$500)/($U$10:$U$500=D2),1)),$L:$L,0)))/($U$9:INDIRECT("$U$"&MATCH(INDEX($L:$L,AGGREGATE(14,6,ROW($U$10:$U$500)/($U$10:$U$500=D2),1)),$L:$L,0))<>D2),1)),$L:$L,0)+1)
It builds on Scott's concept, and finds the 187, then limits the search arrays to the row where it finds 187, and finds the last row that does not have the number you are searching for (21). Then it indexes the first row after that, which will be the first match in the last series.

Find max value from multiple columns and return cell value from adjacent column - Excel

I need help finding a way in excel to identify the max value from multiple columns and return the value in the adjacent column.
Using the table below as an example, let's say I want to simultaneously search columns A and C for the max value (89). Once the max value is identified, I would like excel to return the value in the adjacent column and cell (6) to column E. In reality, I need to find the max and adjacent value from eight columns.
A B C D E
1 65 8 36 15 6
2 24 17 89 6
3 11 20 58 13
4 42 5 29 11
I would greatly appreciate your help.
Thanks,
If the max number does not duplicate you can safely use this formula:
=INDEX($A:$D,AGGREGATE(15,6,ROW($A$1:$D$4)/((MOD(COLUMN(A1:D4),2)=1)*($A$1:$D$4=AGGREGATE(14,6,$A$1:$D$4/(MOD(COLUMN(A1:D4),2)=1),1))),1),AGGREGATE(15,6,COLUMN($A$1:$D$4)/((MOD(COLUMN(A1:D4),2)=1)*($A$1:$D$4=AGGREGATE(14,6,$A$1:$D$4/(MOD(COLUMN(A1:D4),2)=1),1))),1)+1)

Index/Match values from a column using a grid of a different length (Excel 2010)

I am trying to index match values from a long column to a grid of a different length. It looks like this
Word Number Column X Column Y Column Z
This 55 55 33 12
is 62 62 42 18
The 78 78 31 24
42
31
12
18
24
33
The grid (Column X,Y,Z) contains all the values from the Number Column. What I am trying to do is basically index the "Word" column, using a value from the "Number" Column, and looking it up in the value array of X Y Z.
Example (because this is confusing):
Input the Value 33 from the Number column, look for the value in the columns XYZ, and then return the Word "This".
Input the Value 18 from the number column, look for the value in columns XYZ, return the word "is"
etc...
Any help would be very much appreciated!
there is a quicker way and shorter formula to do this:
=IFERROR(INDEX(A:A,IFERROR(MATCH(B2,C:C,0),IFERROR(MATCH(B2,D:D,0),MATCH(B2,E:E,0))),1),"not found")
paste that into, any column really, into row 2 and drag down, it will return the words you require, if value not found it will return "not found"
Here is your spreadsheet starting at cell A1 (without your headers):
A B C D E
1 This 55 55 33 12
2 is 62 62 42 18
3 The 78 45 31 24
4 42
5 31
6 12
7 18
8 24
9 33
10
11 Input: 24
12 Output: The
Copy this into cell C10, and drag the formula across to cell E10:
=IF(ISERROR(IF(ISERROR(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0)))),"",INDIRECT(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0)))))),"",IF(ISERROR(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0)))),"",INDIRECT(IF(ISERROR(MATCH($B$11,C1:C3,0)),"",CONCATENATE("A",MATCH($B$11,C1:C3,0))))))
Copy this to the "output" cell B12 and use cell B11 as your "input":
=CONCATENATE(C10,D10,E10)
VIOLA!!! You're done!
Proof:
The MATCH() function will look for your value in an array (the range). If it finds it, it returns the index of that array (indexed at 1), otherwise it throws an error. Be sure to set the 3rd argument to "0" so that it only looks for EXACT matches.
Paste this into C14:
=MATCH($B$11,C1:C3,0)
Next, we check if the MATCH() function did indeed throw an error. Paste this into C15:
=IF(ISERROR(C14),"",C14)
Now we have the row number of our matched value, so we will use the CONCATENATE() function to join it to our "word column", A, for use in the next step. Paste this into C16:
=CONCATENATE("A",C15)
Using that string from above, use the INDIRECT() function to turn it into an actual cell reference. Paste this into C17:
=INDIRECT(C16)
And finally, check if a legitimate cell reference was created. If so, return the word, otherwise return "". Paste this into C18:
=IF(ISERROR(C17),"",C17)
Lastly, drag the formulas from C14:C18 to E14:E18, and concatenate the results. The cells in row 18 should match the cells in row 10.
Hope this helps :)

Value lookup and rounding questions

I have a cell with a value and I want to lookup that value in a defined range and then grab the closest value in the range that is larger than the lookup cell.
Example: Cell contains 37.24, Range has:
2.75
5.5
8.25
11
16.5
22
28
34
40
46
...
For this instance the formula should return 40 as the value. If the original field was 40.1 it would return 46.
If your 'cell' is A1 and the range of values in E3:E12, please try:
=IFERROR(VLOOKUP(A1,E3:E12,1,0),INDEX(E3:E12,MATCH(A1,E3:E12,1)+1))
This looks (with VLOOKUP) for an exact match and if that fails uses approximate MATCH to find the next lower value and then INDEX steps down one cell.

Excel Find Value next to max value

If I do a simple formula such as
=MAX(J:J)
and I have a table such as
1 2
2 10
3 45
4 1
5 144
I would expect to see my cell = 144
is there a way for me to get the result 5 (as in the column to the left of the max?)
So if you want the value from column I try this formula
=INDEX(I:I,MATCH(MAX(J:J),J:J,0))
MATCH finds the relevant row number then INDEX gives you the value in column I from that same row

Resources