Sei sulla pagina 1di 6

12/20/2016

Excelformula:VLOOKUPwithtwoormorecriteria|Exceljet
Cart Login

Quick, clean, and to the point

Training

Videos

Functions

Formulas

Shortcuts

Blog

Search...

Airtel Unlimited Plans

Select from 4G or 3G
Data Plans, Local/STD
Call Rates and More.

VLOOKUP with two or more criteria

Generic formula
= VLOOKUP(val1 & val2,data,col_index,0)

Related formulas
VLOOKUP with 2 lookup tables
Two-way lookup with VLOOKUP
Calculate grades with VLOOKUP
Get employee information with VLOOKUP
Merge tables with VLOOKUP
VLOOKUP without #N/A error

Explanation
One of the limitations of VLOOKUP is that it only handles one condition: the lookup_value, which is matched against the rst column in
the table.
This makes it dif cult to use VLOOKUP to nd a value in a table based on two or more columns in a table. However, if you have control
over the source data, there's a simple workaround you can use to allow VLOOKUP to handle multiple criteria.
https://exceljet.net/formula/vlookupwithtwoormorecriteria

1/6

12/20/2016

Excelformula:VLOOKUPwithtwoormorecriteria|Exceljet

The trick is to add a helper column that concatenates 2 more more values together, then give VLOOKUP a lookup value that does the
same.
In the example, we want to lookup employee department and group using VLOOKUP, but rst and last names appear separately, so we
don't have a direct way of using both rst and last name in the lookup. The solution is to use a helper column to combine them, then
use the helper column to perform the lookup.
The VLOOKUP formula itself looks like this, where data is a named range that includes the data portion of the table
= VLOOKUP(C3 & D3,data,4,0)
In column B, the helper column, the a formula joins rst name and last name together using concatenation:
= C6 & D6
The First name comes from column C and the Last name from column D.

How this formula works


The helper column joins values from columns that are used as criteria. It must be the rst column of the table, and functions as a "key".
Inside the VLOOKUP function, the lookup value itself is also created by joining the same criteria.

Setting things up
To set up a multiple criteria VLOOKUP, follow these 3 steps:
1. Add a helper column and concatenate (join) values from columns you want to use for your criteria.
2. Set up a VLOOKUP formula that refers to a table that includes the helper column. The helper column must be the rst column in
the table.
3. For the lookup value, join the same criteria in the same order to match values in the helper column.

Related functions
Excel VLOOKUP Function

Related videos
How to use VLOOKUP
How to use VLOOKUP instead of nested IFs
How to use VLOOKUP for approximate matches
Why VLOOKUP is better than nested IFs

See also
23 things you should know about VLOOKUP

Author
Dave Bruns

https://exceljet.net/formula/vlookupwithtwoormorecriteria

2/6

12/20/2016

Excelformula:VLOOKUPwithtwoormorecriteria|Exceljet

Excel Formula Training


Learn Excel formulas and functions quickly with high quality video
training. Over 100 short videos with a full set of practice worksheets. Train
24/7 on any device. Instant access - start today! 100% guarantee.
Click for details and sample videos.

300 Formula Examples, thoughtfully explained.

FasterVLOOKUP
with2VLOOKUPS

Twowaylookup
withVLOOKUP

VLOOKUPwith
numbersandtext

COUNTIFSwith
multiplecriteria...

23thingsyou
shouldknow...

SUMIFSwith
multiplecriteria...

Countiftwocriteria
match

Maximumifmultiple
criteria

Download 200+ Excel Shortcuts


Getover200ExcelshortcutsforWindowsandMacinonehandyPDF.

email address

13Comments
Recommend 6

exceljet

Share

GetthePDF

Login

SortbyNewest

Jointhediscussion
Kumuduamonthago

Ineedurkindsupportistarttomakeemployeedetailtrackeriwanttoknwifiminputemployeenumberiwantallthedetailsofperticularpersoncomes
toonesheetitriedmanyformulasbutcouldntworkplslookingforurkindsupport

https://exceljet.net/formula/vlookupwithtwoormorecriteria

3/6

12/20/2016

Excelformula:VLOOKUPwithtwoormorecriteria|Exceljet
toonesheetitriedmanyformulasbutcouldntworkplslookingforurkindsupport

Reply Share
DaveBruns

Mod >Kumudu amonthago

ThisVLOOKUPexampledoeswhatyouwant.

Reply Share
AllenLee2monthsago

https://uploads.disquscdn.com/...
HiAll,ihaveanissuetogetreturnvalueatC3in2ndimage.Iamexpectingthereturnvalueisanerror.MyintentionistoretrieveC2=IP002259TC02
andC3=#N/Awhenmapwith"A2&B2"and"A3&B3"tothedatatablerespectively.
Itriedonthe"range_lookup=False"anditdoesn'tworkwellforC2asreturnasanerrorasin3rdimage.
Pleaseguidemeonthistoretrievethecorrectdata.Thanksalot.

seemore

Reply Share
SergioMartin2monthsago

cheersmate,prettyuseful!

Reply Share
Bubble3monthsago

Hiall,
Iwouldliketoaskyoutohelpmetodefinetheexcelformulaforthefollowingsituation:
The'StartDate'of'Table2'hastobethefirstdayofthemonthfollowedbythe'EndDate'of'Table1'.
Buttheproblemis:
Ineedtolookupupthe'EndDate'of'Table1'(basedontheroomno.).But'Table1'containstworowswiththesameroomno.withtwodifferent'EndDate'
andIneedtodefinesomeLOOKUPformulatofindthe'EndDate'withthehighestvalue.
IknowthatLOOKUPusesonlythefirstvalueitfinds...
Table1:
ABC
1RoomNo.StartDateEndDate
2G01010516310317
3G01010417310318
4G02010516310317
5G02010417310318
Table2:
seemore

Reply Share
bob3monthsago

CanyouVlookupthreecolumnsandifanyofthemhaveamatchshowtheresult?
=vlookupA:AorB:BorC:C,DD,1,false
WhenIusethe&itmustmatchinallthreecolumns

Reply Share
DaveBruns

Mod >bob 3monthsago

Youcouldchain(nest)togethermultipleVLOOKUPSwithIFERROR.Ifthefirstlookupreturnsanerror,runthesecondlookup,andsoon.Basic
exampleofVLOOKUPwithIFERRORhere.
Chainedexamplehere.

Reply Share
https://exceljet.net/formula/vlookupwithtwoormorecriteria

4/6

12/20/2016

Excelformula:VLOOKUPwithtwoormorecriteria|Exceljet

Reply Share
Dean4monthsago

greatsolution,butmyproblemisalittlemorecomplex.IDOhavecontrolofthedata.Ineedtoreturnavalueusingvlookupbasedupon,2dependant
dropdown(validated)lists.List1producesthefirstcriteria,andlist2,(alreadyConcatenatednames)producesthesecond.Basedupontheoutcomesof
boththesecolumnsIwantmyvlookuptoselectthecorrespondingvalue,andablankwherebothcriteriaisnotmet.Unfortunatelythedataisstoredas8
separateemployeetables,andIhavealreadyusedthedataextensivelytoproduceotherresults.eachtabletheitselfiscompartmentalisedtocorrespond
withthecriteriaforcolumn1.canmyproblemberesolvedwithoutjoiningthe8datatablesinto1?I'mfairlynewatthissomightbemissingsomething
obvious.

Reply Share
DaveBruns

Mod >Dean 4monthsago

Idon'tunderstandthedetailsofyourproblem,butyoucanswitchlookuptablesontheflywithotherlogicorcriteria.Thisformulashowsasimple
examplewithVLOOKUPandtwolookuptables.

Reply Share
DEAN>DaveBruns4monthsago

Manythanks,ImpleasedtosayyouhavesolvedadifferentproblemIhad!andIvesortedtheoriginalbycombiningthe8datatablesinto1
justtosolvemylookupproblem.alreadyappliedthistoseveralareasofmyspreadsheet.greatstuffthanks

Reply Share
DaveBruns

Mod >DEAN 4monthsago

Coolthanksforthenote!

Reply Share
DustinSmall5monthsago

Thanksforthistipsavedmealotofwork!

Reply Share
DaveBruns

Mod >DustinSmall 5monthsago

Greatthanksforyourcomment!

Reply Share
Subscribe d AddDisqustoyoursiteAddDisqusAdd

Privacy

Functions | Formulas
Pivot Tables
Conditional formatting
VLOOKUP | IF function
Keyboard shortcuts
Excel pros | Books

https://exceljet.net/formula/vlookupwithtwoormorecriteria

5/6

12/20/2016

Excelformula:VLOOKUPwithtwoormorecriteria|Exceljet

CeramicWrist
Watch@
299/Only
Don'tMissExtra
20%OffOnOnline
Payment!

ShopNow

I really appreciate your insights. You offer a very valuable service. I tell people about your
website on a regular basis. - Trent

https://exceljet.net/formula/vlookupwithtwoormorecriteria

6/6

Potrebbero piacerti anche