Need to VLOOKUP within Range

ranjith2523

Board Regular
Joined
Apr 29, 2014
Messages
137
Office Version
  1. 365
Hi Friends,

I need to apply a vlookup or other alternate formula to lookup a price within a range and get the output based on the match.

In the below table, I have the price in column A and the value in column B. We have price range data in the D to F column and in the G column I need to put a lookup formula.

For example, if you look into cell G4 it appears as "Used" (cell B2) since the price 2400 (cell A2) falls between range 2359 to 2465. If there is no match then we can leave the cells as blank.

I tried to apply vlookup formula using "Approximate Match" but it didn't work out for me :( .

Can someone please help me to sort it out.

PriceValueStartMidEndValue
2400Used2,1582,2072,255
3000Match2,2562,3072,358
3750Delete2,3592,4122,465Used
5000Retain2,4662,5222,577
2,9453,0123,078Match
3,0793,1493,218
4,7934,9015,009Retain
5,0105,1235,235



Regards,
Ranjith
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
What problem(s) were you having with VLOOKUP?
I added a VLOOKUP in Column B to your example without issues.

Change the formula if you want "Delete" to be displayed for values that are not found in the table.

Book7
ABCDEFG
1PriceValueStartMidEndValue
22400Used215822072255
33000Match225623072358
43750NOT FOUND235924122465Used
55000Retain246625222577
6294530123078Match
7307931493218
8479349015009Retain
9501051235235
Sheet1
Cell Formulas
RangeFormula
B2:B5B2=IF(VLOOKUP(A2,D2:G9,4,TRUE)=0,"NOT FOUND",VLOOKUP(A2,D2:G9,4,TRUE))
 
Upvote 0
Assuming the end value is the criteria, judging by the "Retain" in G8, which should only be a "Retain" at or above a $5,000 price point, you're looking for this:

In Cell G2:

=IF(F2<$A$3,$B$2,IF(AND(F2>$A$3-1,F2<$A$4),$B$3,IF(AND(F2>$A$4-1,F2<$A$5),$B$4,IF(F2>$A$5-1,$B$5,""))))

Once you have that in G2, copy the cell and paste it down the G column, from row 2 to 9.

The setup here uses cells rather than values, so you can change your price point criteria if you want, as well as your descriptors relative to the price points.
 
Upvote 0
What problem(s) were you having with VLOOKUP?
I added a VLOOKUP in Column B to your example without issues.

Change the formula if you want "Delete" to be displayed for values that are not found in the table.

Book7
ABCDEFG
1PriceValueStartMidEndValue
22400Used215822072255
33000Match225623072358
43750NOT FOUND235924122465Used
55000Retain246625222577
6294530123078Match
7307931493218
8479349015009Retain
9501051235235
Sheet1
Cell Formulas
RangeFormula
B2:B5B2=IF(VLOOKUP(A2,D2:G9,4,TRUE)=0,"NOT FOUND",VLOOKUP(A2,D2:G9,4,TRUE))
Thank you so much for your quick reply and sorry if i confused you with my statement.

Actually, i need to put a vlookup in G column and not in the B column (which I mentioned in the second line of my initial post).

E.g., The price 2400 (cell A2) falls between the range D4 to F4 and in G4 the formula should bring the value "Used" (Cell B2 value).

Please let me know if my explanation is not clear.

Regards,
Ranjith
 
Upvote 0
Assuming the end value is the criteria, judging by the "Retain" in G8, which should only be a "Retain" at or above a $5,000 price point, you're looking for this:

In Cell G2:

=IF(F2<$A$3,$B$2,IF(AND(F2>$A$3-1,F2<$A$4),$B$3,IF(AND(F2>$A$4-1,F2<$A$5),$B$4,IF(F2>$A$5-1,$B$5,""))))

Once you have that in G2, copy the cell and paste it down the G column, from row 2 to 9.

The setup here uses cells rather than values, so you can change your price point criteria if you want, as well as your descriptors relative to the price points.
Thanks for your reply.

If if copy paste it down the G column i am getting the results in all cells which is not correct :(.

It seems your formula refers only the cell F2 and it should refer to the range D to F.

E.g, The price 2400 (Cell A2) fall only in the range cell D4 to F4 so the "Used" should reflect only in G4 and not in G3 and G2.

PriceValueStartMidEndValue
2400Used2,1582,2072,255Used
3000Match2,2562,3072,358Used
3750Delete2,3592,4122,465Used
5000Retain2,4662,5222,577Used
2,9453,0123,078Match
3,0793,1493,218Match
4,7934,9015,009Retain
5,0105,1235,235Retain
 
Last edited:
Upvote 0
Thanks for your reply.

If if copy paste it down the G column i am getting the results in all cells which is not correct :(

PriceValueStartMidEndValue
2400Used2,1582,2072,255Used
3000Match2,2562,3072,358Used
3750Delete2,3592,4122,465Used
5000Retain2,4662,5222,577Used
2,9453,0123,078Match
3,0793,1493,218Match
4,7934,9015,009Retain
5,0105,1235,235Retain
The first two items were actually below the first price point. It just needs to be adjusted.
But item three is above 2400 and less than 3000. So it's Used.
Item four is above 2400, but below 3000. Used.
Item five is above 3000, but below 3750, so it's Match.
Item six is above 3000, but below 3750. Match.
Item seven is above 5000. Retain.
Item eight is above 5000. Retain.

You didn't really have any sort of specification for vehicles that fell below the 2400 price point.
 
Upvote 0
And again, as I specified, this was made with the assumption that the end value in Column F was the basis, per your example in G8. If the basis should be the Start or Mid value, all the F2 references would merely need to be changed to D2 or E2.
 
Upvote 0
The first two items were actually below the first price point. It just needs to be adjusted.
But item three is above 2400 and less than 3000. So it's Used.
Item four is above 2400, but below 3000. Used.
Item five is above 3000, but below 3750, so it's Match.
Item six is above 3000, but below 3750. Match.
Item seven is above 5000. Retain.
Item eight is above 5000. Retain.

You didn't really have any sort of specification for vehicles that fell below the 2400 price point.
Thank you so much for your explanation and effort.

But the requirement is different, the formula should return the value if the price falls within the range.

Thanks again for your time and help.

Regards,
Ranjith
 
Upvote 0
Thank you so much for your explanation and effort.

But the requirement is different, the formula should return the value if the price falls within the range.

Thanks again for your time and help.

Regards,
Ranjith
Whatever it is you're trying to do, I expect it's not difficult. I'm apparently misunderstanding what you're trying to make it do. Perhaps if you posted a table with typed in "results" as you would want it to appear so I can understand the end result you're trying to accomplish.
 
Upvote 0
Thanks again for your reply.

Even if i change the reference to D2 or E2, i will get the result in all G column cells but the requirement is if the A column price not fall in the particular range (D to F) the G column formula should reflect either as Blank or Not found. If the A column price falls between the range ((D to F)) the it should reflect the B column value (e.g, Used, Delete, Retain, etc.,)
And again, as I specified, this was made with the assumption that the end value in Column F was the basis, per your example in G8. If the basis should be the Start or Mid value, all the F2 references would merely need to be changed to D2 or E2
 
Upvote 0

Forum statistics

Threads
1,215,339
Messages
6,124,381
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top