Lookup help please.

courtmaster1998

New Member
Joined
May 3, 2023
Messages
2
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have been looking for a excel formula that would give me the following:

Col A. COL B. COL C. Col D. Col E
1.. $1. $5. Red. $8. Orange
2. $6. $10. Orange
3. $11. $15. Pink
4. $16. $20. Purple

And so on

Column A & B are the ranges. Column C is the output color for any number in that range

D1 is a supplied number to find within the ranges and then when located what the color should be as the output answer.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Welcome to the MrExcel board!

Here are some options that you could consider.

23 05 04.xlsm
ABCDEFG
115Red8OrangeOrangeOrange
2610Orange5RedRedRed
31115Pink17PurplePurplePurple
41620Purple
Lookup
Cell Formulas
RangeFormula
E1:E3E1=XLOOKUP(D1,A$1:A$4,C$1:C$4,,-1)
F1:F3F1=VLOOKUP(D1,A$1:C$4,3)
G1:G3G1=INDEX(C$1:C$4,MATCH(D1,A$1:A$4))
 
Upvote 0
Welcome to the MrExcel board!

Here are some options that you could consider.

23 05 04.xlsm
ABCDEFG
115Red8OrangeOrangeOrange
2610Orange5RedRedRed
31115Pink17PurplePurplePurple
41620Purple
Lookup
Cell Formulas
RangeFormula
E1:E3E1=XLOOKUP(D1,A$1:A$4,C$1:C$4,,-1)
F1:F3F1=VLOOKUP(D1,A$1:C$4,3)
G1:G3G1=INDEX(C$1:C$4,MATCH(D1,A$1:A$4))
Hi Peter,
Thank you for the quick response. It works excellent. Only problem I have, if D1 falls before the first range A1:B1, I get #N/A. How can a fix it so that the output is $0?

Regards, Tim
 
Last edited by a moderator:
Upvote 0
if D1 falls before the first range A1:B1, I get #N/A. How can a fix it so that the output is $0?
It depends which of the 3 suggestion you chose. Again options

23 05 04.xlsm
ABCDEFG
1LowHigh$Input
210141008000
31519200
42024300
52529400
Lookup (2)
Cell Formulas
RangeFormula
E2E2=XLOOKUP(D2,A$2:A$5,C$2:C$5,0,-1)
F2F2=IFNA(VLOOKUP(D2,A$2:C$5,3),0)
G2G2=IFNA(INDEX(C$2:C$5,MATCH(D2,A$2:A$5)),0)


Another choice would be to add a new first row to the lookup table and then you could use the original formula(s)

23 05 04.xlsm
ABC
1LowHigh$
2090
31014100
41519200
52024300
62529400
Lookup (3)
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

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