How can I find the code I need based on multiple lookup values in my table, based on data in a reference table

BradleyS

Active Member
Joined
Oct 28, 2006
Messages
333
Office Version
  1. 2010
Platform
  1. Windows
I'm trying to find the correct code which include numbers and letters using a lookup table and checking it against 4 lookup values.

In the example below the left table A to E is a static table and is the reference table

The right table normally on a separate sheet has multiple lines of varying data, where I need to find the correct code based matching the Name, Age and Age Calc from, using the information in the reference table.

I have tried VLOOKUP but can't get it to work with multiple values. I have had some success with INDEX/MATCH, but I'm struggling with the how to determine the age between the age range values. I have got to here: =INDEX(E2:E6,MATCH(G2&I2,A2:A6&D2:D6,0)), but can't workout how to include the age lookup

I also tried SUMIFS(E2:E6,A2:A6,G2,B2:B6,"<="&H2,C2:C6,">="&H2,D2:D6,I2) which works, but only where the codes are numbers. It fails when they have letters in the code

The answers I need in J are: 567a8, 76a54, 4679, 76a54, 12a34. What would be my best method of achieving my code results?

lookups.jpg
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try
Excel Formula:
=FILTER(E$2:E$6,(A$2:A$6=G2)*(B$2:B$6<=H2)*(C$2:C$6>=H2)*(D$2:D$6=I2))
 
Upvote 0
Wow I have never used or known about FILTER. Is this available in Excel 2010 as I need to run it on a system that only uses 2010
 
Upvote 0
Is this available in Excel 2010
Only in office 365 at the moment. Excel 2019 and older do not have it. This should work as far back as 2010, but nothing older than that.
Excel Formula:
=INDEX(E:E,AGGREGATE(15,6,ROW(E$2:E$6)/(A$2:A$6=G2)/(B$2:B$6<=H2)/(C$2:C$6>=H2)/(D$2:D$6=I2),1))
 
Upvote 0
Wow another one I have never used AGGREGATE. Thank goodness for clever people like you. Thank you for this it works a treat
 
Upvote 0
If the following applies to your reference table ..
- age bands do not overlap for a particular text/date combination (as it seems for your small sample)
- the data is sorted by name, Age Calc From and Age from (as it seems your small sample might be)
then you could possibly also use this.

Note the red instruction at the bottom.

21 10 22.xlsm
ABCDEFGHIJ
2TEXT164931/03/2022aTEXT15231/03/2022b
3TEXT15012031/03/2022bTEXT25531/03/2022d
4TEXT264931/03/2022cTEXT3431/03/2022e
5TEXT25012031/03/2022dTEXT26731/03/2022d
6TEXT30531/03/2022eTEXT14831/03/2022a
Lookup
Cell Formulas
RangeFormula
J2:J6J2=LOOKUP(H2,IF(A$2:A$6=G2,IF(D$2:D$6=I2,B$2:E$6)))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Wouldn't this work, without using an array formula.
Excel Formula:
=LOOKUP(2,1/((A$2:A$6=G2)*(B$2:B$6<=H2)*(C$2:C$6>=H2)*(D$2:D$6=I2)),E$2:E$6)
 
Upvote 0
Wouldn't this work, without using an array formula.
Excel Formula:
=LOOKUP(2,1/((A$2:A$6=G2)*(B$2:B$6<=H2)*(C$2:C$6>=H2)*(D$2:D$6=I2)),E$2:E$6)
Yes this also works a treat, and to my small mind is actually easier for me to understand. Thank you all.
 
Upvote 0
Wouldn't this work, without using an array formula.
Or this
Excel Formula:
=LOOKUP(H2,B$2:B$6/(A$2:A$6=G2)/(D$2:D$6=I2),E$2:E$6)
Not tested beyond the basic example provided, but using the same assumptions as Peter, I believe it should be fine.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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