Retrieve excel row value by checking if value within range of 2 columns - excel

Any idea for an excel formula that should accept an input and return the value of the relevant row in Price column if the value entered is greater than the LowerRange column but lower than the UpperRange column.
i.e. input of 6 would return 5, input of 18 would return 10, input of 52 would return 30.
LowerRange UpperRange Price
1 10 5
11 20 10
21 30 15
31 40 20
41 50 25
51 60 30
InputCell:
InputFormula:

Use VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]) with range_lookup set to TRUE
From Excel help file:
If range_lookup is either TRUE or is omitted, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned.
If range_lookup is either TRUE or is omitted, the values in the first column of table_array must be placed in ascending sort order; otherwise, VLOOKUP might not return the correct value.
So, for your data use =VLOOKUP(B10,$A$2:$C$8,3,1) where value to look up is in B10 (add a value of 61 to col A and =NA() to col C to the end of the data to handle inputs > 60)

Related

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)

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

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

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