Vlookup from table based on variable weight range

meksdigital

New Member
Joined
Jan 8, 2023
Messages
3
Office Version
  1. 365
Platform
  1. MacOS
Hi all and HNY!

I have a table with prices based on weights and but having trouble trying to return the price value into another sheet depending on the weight.

Rates Table
Weight >Weight <= Price
0​
5​
$8​
5​
10​
$16​
10​
20​
$22​

Items with weight
ItemsWeightPrice
Item 1?
Item 2?
Item 3?

Any thoughts on how I can get the table data into my other table? Having lots of trouble trying with vlookups + less thans to pull in prices

Cheers all
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
In fact, this is a perfect scenario to use VLOOKUP's close match=TRUE. 'Items with weight' C2:
Excel Formula:
=VLOOKUP(B2,'Rates Table'!$A$2:$C$4,3,TRUE)
 
Upvote 0
In fact, this is a perfect scenario to use VLOOKUP's close match=TRUE. 'Items with weight' C2:
Excel Formula:
=VLOOKUP(B2,'Rates Table'!$A$2:$C$4,3,TRUE)

Thanks for the reply....

Weights could, but will probably not be one of the specificed values.... eg. weight could be between 0 and 5, or between 5 and 10

edit* will update table above... would close match true work under these circumstances?

Thanks!
 
Upvote 0
I think it works quite OK.
1673244534889.png
 
Upvote 0
It's strange.
Your "0" is not a "0" but a "0" and a unicode(8203).
The same to 5, 10, 20, $8...。

So if you can't vlookup well, maybe try to key-in again all the numbers in the rates table.
 
Upvote 0
I think it works quite OK.
I'm not so sure. From my reading of the Rates table a weight of 5 should return 8 not 16 per your formula in column D below.

@meksdigital
My suggestion is in column C

23 01 09.xlsm
ABCD
1Items with weight
2ItemsWeightPrice
3Item 13.588
4Item 271616
5Item 312.22222
6Item 45816
Results
Cell Formulas
RangeFormula
C3:C6C3=XLOOKUP(B3,'Rates Table'!B$2:B$4,'Rates Table'!C$2:C$4,,1)
D3:D6D3=VLOOKUP(B3,'Rates Table'!$A$2:$C$4,3,TRUE)


23 01 09.xlsm
ABC
1Weight >Weight <=Price
205$8
3510$16
41020$22
Rates Table
 
Upvote 0
It's strange.
Your "0" is not a "0" but a "0" and a unicode(8203)..
A bit off topic but when the OPs copy data directly into the post it is quite common for it to pick up a character 8203 somewhere along the line.
I keep a little Replace ChrW(8203) macro in my personal workbook to remove it when it happens.
 
Upvote 0
Yes,
A bit off topic but when the OPs copy data directly into the post it is quite common for it to pick up a character 8203 somewhere along the line.
I keep a little Replace ChrW(8203) macro in my personal workbook to remove it when it happens.
It's strange.
Your "0" is not a "0" but a "0" and a unicode(8203).
The same to 5, 10, 20, $8...。

So if you can't vlookup well, maybe try to key-in again all the numbers in the rates table.
Happened the same to me.
 
Upvote 0

Forum statistics

Threads
1,224,808
Messages
6,181,073
Members
453,020
Latest member
mattg2448

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