Return indexed value based on range within a column name on another sheet

jdk8008

New Member
Joined
May 2, 2015
Messages
11
Office Version
  1. 2019
Platform
  1. MacOS
For this example, I will use fruits and weights to represent the formula I am trying to construct. I would like to return the rank based on the fruit falling within a weight range.

For example, I need the following values returned in Sheet 1 for C2, C3, and C4

C2 = 0 (Because it is greater than or equal to 0, and less than 80 for the Apple column in sheet 2)
C3 = 2 (Because it is greater than or equal to 120, and less than 140 for the Banana column in sheet 2)
C4 = 3 (Because it is greater than or equal to 160 in the Orange column of sheet 2)

I am looking for a formula that I can fill down column C in sheet 1. Note that the weight value will never be less than 0.

Sheet 1
FruitWeightRank
Apple70
Banana120
Orange170

Sheet 2
RankAppleBananaOrange
3120140160
2100120140
180100120
0000

Thanks for the help!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Try:

Book4
ABCD
1RankAppleBananaOrange
23120140160
32100120140
4180100120
50000
Sheet2


Book1
ABC
1FruitWeightRank
2Apple700
3Banana1202
4Orange1703
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=MAX(Sheet2!$A$2:$A$5*(Sheet2!$B$2:$D$5<=B2)*(Sheet2!$B$1:$D$1=A2))
Press CTRL+SHIFT+ENTER to enter array formulas.


Edit: This doesn't require CSE:

Excel Formula:
=AGGREGATE(14,4,Sheet2!$A$2:$A$5*(Sheet2!$B$2:$D$5<=B2)*(Sheet2!$B$1:$D$1=A2),1)
 
Last edited:
Upvote 0
Solution
Try:

Book4
ABCD
1RankAppleBananaOrange
23120140160
32100120140
4180100120
50000
Sheet2


Book1
ABC
1FruitWeightRank
2Apple700
3Banana1202
4Orange1703
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=MAX(Sheet2!$A$2:$A$5*(Sheet2!$B$2:$D$5<=B2)*(Sheet2!$B$1:$D$1=A2))
Press CTRL+SHIFT+ENTER to enter array formulas.


Edit: This doesn't require CSE:

Excel Formula:
=AGGREGATE(14,4,Sheet2!$A$2:$A$5*(Sheet2!$B$2:$D$5<=B2)*(Sheet2!$B$1:$D$1=A2),1)
This worked perfectly, thanks!
 
Upvote 0
Another possibility to consider ..
  1. Sort your Sheet2 table with Rank ascending and make that table a formal Excel table.

    jdk8008.xlsm
    ABCD
    1RankAppleBananaOrange
    20000
    3180100120
    42100120140
    53120140160
    Sheet2


  2. Then use this in Sheet1. This would automatically adapt ranges if the number of fruits or ranks in Sheet2 changed.

    jdk8008.xlsm
    ABC
    1FruitWeightRank
    2Apple700
    3Banana1202
    4Orange1703
    Sheet1
    Cell Formulas
    RangeFormula
    C2:C4C2=INDEX(Table1[Rank],MATCH(B2,INDIRECT("Table1["&A2&"]")))
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,301
Members
452,633
Latest member
DougMo

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