# Vlookup Formula with 2 conditions

Hi,
Can you help me with a Vlookup formula for 2 conditions
example:

lookup table (value)

cat      0     25
cat      1     50
cat      3     80
dog     0     11
dog     1     27
dog     7     56

what is value for cat 1      answer 50
what is value for dog 0     answer  11

Many thanks

Ian
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Group Finance ManagerCommented:
VLOOKUP will only find the first match, but using a hidden helper column is probably the simplest way

Here's an explanation of using Index/Match as an array formula

INDEX and MATCH with multiple criteria
Formula.xlsx
Excel & VBA ExpertCommented:
Hi Ian,

There is no need for a helper column. You may try this formula...

``````=IFERROR(INDEX(\$C\$2:\$C\$7,MATCH(E2&F2,INDEX(\$A\$2:\$A\$7&\$B\$2:\$B\$7,),0)),"")
``````
Refer to the attached for more details.
IndexMatch.xlsx
retiredAuthor Commented:
Hi Neeraj,

I have attached a spreadsheet hopefully it makes it clearer
Thanks
Ian
lookup2conditions.xlsx
Excel & VBA ExpertCommented:
Hi Ian,

Try this to see if this is what you are trying to achieve...

In B14
``````=IFERROR(INDEX(\$T\$14:\$T\$4203,MATCH(B\$13&\$V\$14,INDEX(\$R\$14:\$R\$4203&\$S\$14:\$S\$4203,0),0)),"")
``````
and then copy across.
lookup2conditions.xlsx
retiredAuthor Commented:
Not quite right yet Neeraj.
I've attached the sheet with data V14:AK14 same as row 15. This is the data we are looking at.
Therefore row data B14:Q14 and B15:Q15 should also be the same.
I have placed the correct returned values in black in row 15
thanks
lookup2conditionsV2.xlsx
Excel & VBA ExpertCommented:
I hope I understood your requirement correctly.

In B14
``````=IFERROR(INDEX(\$T\$14:\$T\$4203,MATCH(B\$13&V14,INDEX(\$R\$14:\$R\$4203&\$S\$14:\$S\$4203,0),0)),"")
``````
Copy across and down.
lookup2conditionsV2.xlsx

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

retiredAuthor Commented:
Seems to be a number of blank cells and all cells should have a value.
I have given a lookup  example on the attached sheet which I'm sure is an
improvement on my previous attempts.
Ian
lookup2conditionsV3.xlsx
Excel & VBA ExpertCommented:
For formula in F16, the referenced cell Z16 has a number 8.5 actually while you see 9 in Z16 because of cell formatting. Select the cell Z16 and look at the formula bar, you will notice a number 8.5 underneath that cell and there is no combination of DILAC and 8.5 in the lookup data.
If you overwrite the Z16 with 9, the formula will return the output in F16.
Let me know if this is not the case.
retiredAuthor Commented:
My apologies Neeraj, the data in the right columns should have been whole numbers. My mistake.
I haphazardly copied data from a wrong sheet.
All okay now.
Thanks a million, genius
Ian
Excel & VBA ExpertCommented:
You're welcome Ian!
No problem. Glad it is working as desired now.
Thanks for the feedback. :)
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.