Find from list

Beatrice

Board Regular
Joined
Sep 17, 2019
Messages
85
Office Version
  1. 2019
Platform
  1. Windows
greeting, I need some help to look for the related prices, example list as below:


Length (cm)Width (cm)PRICE
2535
200​
3550
300​
3370
350​
4157
400​
4664
500​
5070
600​
5782
800​
6490
1000​
70100
1200​

I need a formula not only look for the exact value, but also include the odd sizes not from the list. (equal or greater than)
for example, 60 x 85 should take PRICE at 1000.
another example 45 x 75 will have to take PRICE 1200 (rotated to fit)

Thank you in advance for helping.
 
It seems an obvious mistake in manual evaluation, so I decided to ignore it.
Perhaps so, though I thought it worth asking the OP.

@Beatrice
Assuming it was just an error in your expected result that I asked about earlier, this may be another option for you as it enables the formula to be somewhat simpler & with standard entry instead of Ctrl+Shift+Enter, provided it is acceptable to arrange your table differently.
Sort the table in descending order instead of ascending and include a "Not available" row at the top with values larger than you will ever want to look up.

20 03 13.xlsm
BCD
1Size range (cm)Price
285601000
3
4Size range (cm)Price
510000001000000Not available
6701001200
764901000
85782800
95070600
104664500
114157400
123550300
133370350
142535200
Price
Cell Formulas
RangeFormula
D2D2=INDEX(D5:D14,MIN(MATCH(MIN(B2:C2),B5:B14,-1),MATCH(MAX(B2:C2),C5:C14,-1)))
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Perhaps so, though I thought it worth asking the OP.

@Beatrice
Assuming it was just an error in your expected result that I asked about earlier, this may be another option for you as it enables the formula to be somewhat simpler & with standard entry instead of Ctrl+Shift+Enter, provided it is acceptable to arrange your table differently.
Sort the table in descending order instead of ascending and include a "Not available" row at the top with values larger than you will ever want to look up.
Peter,

You are making a silent assumption that the sizes can be sorted so that both width and length decrease. This might be impossible, e.g. take 10x12 and 9x14.
I admit making an assumption too: that length is never greater than width.

@Beatrice, please comment or at consider.

J.Ty.
 
Upvote 0
You are making a silent assumption that the sizes can be sorted so that both width and length decrease.
That is one way of looking at it. My actual assumption was that the OP's data was representative.

After all, if the data cannot be sorted appropriately, how would you logically decide the correct answer?
For example, in the sample below, your formula gives 220 but rows 7 & 8, though still not exact, to me both look better fits to the data than row 6.

20 03 13.xlsm
BCD
1Size range (cm)Price
210100220
3
4Size range (cm)Price
5850200
640100220
710101350
89100400
946130500
1060140600
1162150800
12641601000
13701701200
Price 3
Cell Formulas
RangeFormula
D2D2=IFERROR(INDEX(D5:D13,MIN(IF(B5:B13>=MIN(B2,C2),IF(C5:C13>=MAX(B2:C2),ROW(B5:B13)-ROW(D4),10^7),10^7))),"not available")
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
OK, I have made another variant, which works without any particular assumptions about the data and returns the cheapest option available. The answer 0 means that there is no available item of suitable size.

Beatrice.xlsx
BCD
1Size range (cm)Price
2701010
3
4Size range (cm)Price
52535200
63550300
73370350
84157400
94664500
105070600
115782800
1264901,000
13701001,200
MrExcel (2)
Cell Formulas
RangeFormula
D2D2=MIN(IF((B5:B13>=B2)*(C5:C13>=C2)+(B5:B13>=C2)*(C5:C13>=B2),D5:D13,""))
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
@Peter_SSs , @ J.Ty.
Thanks for helping. After read above comment, I should clarify that:
1. The table must be ascending,
2. max size will be 70 x 100, but width and length could interchange.

I used the format provided by J.Ty
{=IFERROR(INDEX(D5:D13,MIN(IF(B5:B13>=MIN(B2,C2),IF(C5:C13>=MAX(B2:C2),ROW(B5:B13)-ROW(D4),10^7),10^7))),"not available")}
that was workable.
 
Upvote 0
I used the format provided by J.Ty
{=IFERROR(INDEX(D5:D13,MIN(IF(B5:B13>=MIN(B2,C2),IF(C5:C13>=MAX(B2:C2),ROW(B5:B13)-ROW(D4),10^7),10^7))),"not available")}
that was workable.
OK, glad you got something that suited you. :)
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,530
Members
448,969
Latest member
mirek8991

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