ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   need help creating formula (https://www.excelbanter.com/excel-worksheet-functions/121977-need-help-creating-formula.html)

[email protected]

need help creating formula
 
Does anyone know how to write a formula that will lookup a value and
return the next largest value?

For an example:

A B
1 100 120
2 200
3 300
4 400


I know the formula to return the value that's less than the value I am
looking up.
This is what I use =VLOOKUP(B1, A2:A4, 1, TRUE)
returns 100

How do I get it to return 200? Since 120 is between 100 and 200.

Any help is greatly appreciated!


Niek Otten

need help creating formula
 
Sort your data in A descending (400,300,200,100).
Then use this formula:

=INDEX(A1:A4,MATCH(B1,A1:A4,-1))


--
Kind regards,

Niek Otten
Microsoft MVP - Excel

wrote in message oups.com...
| Does anyone know how to write a formula that will lookup a value and
| return the next largest value?
|
| For an example:
|
| A B
| 1 100 120
| 2 200
| 3 300
| 4 400
|
|
| I know the formula to return the value that's less than the value I am
| looking up.
| This is what I use =VLOOKUP(B1, A2:A4, 1, TRUE)
| returns 100
|
| How do I get it to return 200? Since 120 is between 100 and 200.
|
| Any help is greatly appreciated!
|



[email protected]

need help creating formula
 
thank you, that worked!


Niek Otten wrote:
Sort your data in A descending (400,300,200,100).
Then use this formula:

=INDEX(A1:A4,MATCH(B1,A1:A4,-1))


--
Kind regards,

Niek Otten
Microsoft MVP - Excel

wrote in message oups.com...
| Does anyone know how to write a formula that will lookup a value and
| return the next largest value?
|
| For an example:
|
| A B
| 1 100 120
| 2 200
| 3 300
| 4 400
|
|
| I know the formula to return the value that's less than the value I am
| looking up.
| This is what I use =VLOOKUP(B1, A2:A4, 1, TRUE)
| returns 100
|
| How do I get it to return 200? Since 120 is between 100 and 200.
|
| Any help is greatly appreciated!
|




All times are GMT +1. The time now is 04:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com