VLOOKUP with Condition

anelem

New Member
Joined
Jul 18, 2020
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hi
Sheet 1 :
Col A Col B Col C
Row1 Joe Green 45100
Row2 Joe Red 30000
Row3 Joe Blue 15000
Row4 Sag Green 2077
Row5 Sag Red 31001
Row6 Sag Blue 45000

Sheet 2 :
Col A Col B Col C
Row1 Joe Green ?
Row2 Joe Red ?
Row3 Sag Blue ?
Row4 Sag Green ?

Looking to get answer in Sheet 2 Col C
So Sheet 2 Col A must match to Sheet 1 Col A
When found, Lookup Sheet 2 B1 on Sheet 1 Col B
When found, return contents in Col C

Hope I have explained this well.
If anyone can please assist will make my job easier for me.
Thanking you in advance
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
not sure if column A has row - or if that was illustration

Name in column A on both sheets
Values in column B on sheet 1

and you want those values to be matched against the name on sheet 2

=Vlookup(Sheet2!A1, Sheet1$A$2:$B$100,2,false)

example on 1 sheet so you can see the principle
Book1
ABCDEFG
1Sheet 1Sheet 2
2Joe Green45100Joe Green45100
3Joe Red30000Joe Red30000
4Joe Blue15000Sag Green2077
5Sag Green2077Sag Blue45000
6Sag Red31001
7Sag Blue45000
Sheet1
Cell Formulas
RangeFormula
F2:F5F2=VLOOKUP(E2,$A$2:$B$7,2,FALSE)
 
Last edited:
Upvote 0
Hi, thanks for the very quick reply . .
Sorry my layout was not very clear.


Sheet 1Sheet 2
JoeGreen
45100​
JoeGreen?
JoeRed
30000​
JoeRed?
JoeBlue
15000​
SagGreen?
SagGreen
2077​
SagBlue?
SagRed
31001​
SagBlue
45000​
 
Upvote 0
How about
+Fluff New.xlsm
ABC
1
2JoeGreen45100
3JoeRed30000
4JoeBlue15000
5SagGreen2077
6SagRed31001
7SagBlue45000
Sheet1


+Fluff New.xlsm
ABC
1
2JoeGreen45100
3JoeRed30000
4SagGreen2077
5SagBlue45000
Sheet2
Cell Formulas
RangeFormula
C2:C5C2=INDEX(Sheet1!$C$2:$C$7,MATCH(A2&"|"&B2,Sheet1!$A$2:$A$7&"|"&Sheet1!$B$2:$B$7,0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
i would use an index/match to do the lookup
you will need a Control+shift+enter to make an array, microsoft 365 does that automatically now
Book1
ABCDEFG
2Sheet 1Sheet 2
3JoeGreen45100JoeGreen45100
4JoeRed30000JoeRed30000
5JoeBlue15000SagGreen2077
6SagGreen2077SagBlue45000
7SagRed31001
8SagBlue45000
Sheet2
Cell Formulas
RangeFormula
G3:G6G3=INDEX($C$3:$C$8,MATCH(E3&F3,$A$3:$A$8&$B$3:$B$8,0))
 
Upvote 0
Genius!! Thanks I have used Etaf solution - very simple and so easy to understand.
Thank you I really appreciate your assistance.
 
Upvote 0
This may not be a problem with your data, but you could get wrong answers with etaf's solution
+Fluff New.xlsm
ABC
1
2JoeGReen200
3JoeGreen45100
4JoeRed30000
5JoeBlue15000
6SagGreen2077
7SagRed31001
8SagBlue45000
Sheet1


+Fluff New.xlsm
ABCD
1Fluffetaf
2JoeGreen45100200
3JoeRed3000030000
4SagGreen20772077
5SagBlue4500045000
Sheet2
Cell Formulas
RangeFormula
C2:C5C2=INDEX(Sheet1!$C$2:$C$8,MATCH(A2&"|"&B2,Sheet1!$A$2:$A$8&"|"&Sheet1!$B$2:$B$8,0))
D2:D5D2=INDEX(Sheet1!$C$2:$C$8,MATCH(A2&B2,Sheet1!$A$2:$A$8&Sheet1!$B$2:$B$8,0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Given that the results are numeric, why not simply use sumifs?

=SUMIFS(Sheet1!C$2:C$8,Sheet1!A$2:A$8,A2,Sheet1!B$2:B$8,B2)
 
Upvote 0
@Fluff
Thats interesting, never thought of that issue, before, learning all the time, thank you, for pointing it out
I'm assuming the | is just a random character to separate the 2 cells , so your example of JoeG | Reen cannot happen
No significance in using the | just cleaner - BUT Z or 2 or any character would work
 
Upvote 0
No real significance to the |, just that it's unlikely to be in the data.
For instance if I used G as the delimiter & there was Joe Reen in A2,B2 you would still get the wrong answer.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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