tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,913
- Office Version
- 365
- 2019
- Platform
- Windows
Assuming I have data like this in cells A1 through to B5:
10 Apple
20 Orange
30 Pear
40 Plum
50 Watermelon
I want a formula so if I enter 10, it returns Apple and if I enter 20 it will return Orange.
That formula would be:
where J1 is the value to lookup.
However, I want a variant of this, in that if I enter 15, I want to return Orange.
but the following formula returns Apple:
The following taken from here:
does indeed work:
but if I enter a value less than 10 or greater than 50, I get #N/A and /REF! respectively.
How can I amend the formula for my needs?
Thanks
10 Apple
20 Orange
30 Pear
40 Plum
50 Watermelon
I want a formula so if I enter 10, it returns Apple and if I enter 20 it will return Orange.
That formula would be:
Code:
=VLookup(J1,A1:B5,2,False)
where J1 is the value to lookup.
However, I want a variant of this, in that if I enter 15, I want to return Orange.
but the following formula returns Apple:
Code:
=VLookup(J1,A1:B5,2,True)
The following taken from here:
Code:
https://www.extendoffice.com/documents/excel/2704-excel-vlookup-next-largest-value.html
does indeed work:
Code:
=INDEX(B1:B5,MATCH(J1,A1:A5)+(LOOKUP(D5,A1:A5)<>J1))
but if I enter a value less than 10 or greater than 50, I get #N/A and /REF! respectively.
How can I amend the formula for my needs?
Thanks