Vlookup in if statement?

Ronix

Board Regular
Joined
Aug 18, 2014
Messages
54
Hi Guys,

let´s imagine this.
In first sheet I have in these three columns A, B, C these values:
Column A:
car
boat
Column B:
red
green
Column C:
automatic
manual
How the statement will look like if I need to get respective value into second sheet to the cell D2 and E2?
If I write to the C2 value "boat" I will automatically get value green to the cell D2 and value manual to the cell E2.
And until the value is not in D2 and E2 these cells are empty.
Thx in advance!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Maybe something like this


Excel 2010[TABLE="class: grid, width: 300"]
<tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH][/TH]
[TH]A
[/TH]
[TH]B
[/TH]
[TH]C
[/TH]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD]car
[/TD]
[TD]red
[/TD]
[TD]automatic
[/TD]
[/TR]
[TR]
[TD="align: center"]2
[/TD]
[TD]boat
[/TD]
[TD]green
[/TD]
[TD]manual
[/TD]
[/TR]
</tbody>[/TABLE]
Sheet5

Excel 2010[TABLE="class: grid, width: 400"]
<colgroup><col><col><col><col></colgroup><tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TD][/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]boat[/TD]
[TD]green[/TD]
[TD]manual[/TD]
[/TR]
</tbody>[/TABLE]
Sheet6

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="class: grid, width: 100%"]
<tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TD="width: 10"]Cell[/TD]
[TD="align: left"]Formula[/TD]
[/TR]
[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]D2[/TH]
[TD="align: left"]=IF(C2="","",VLOOKUP(C2,Sheet5!A1:C2,2,0))[/TD]
[/TR]
[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]E2[/TH]
[TD="align: left"]=IF(C2="","",VLOOKUP(C2,Sheet5!A1:C2,3,0))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Maybe something like this


Excel 2010[TABLE="class: grid, width: 300"]
<tbody>[TR]
[TH][/TH]
[TH]A[/TH]
[TH]B[/TH]
[TH]C[/TH]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]car[/TD]
[TD]red[/TD]
[TD]automatic[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]boat[/TD]
[TD]green[/TD]
[TD]manual[/TD]
[/TR]
</tbody>[/TABLE]
Sheet5

Excel 2010[TABLE="class: grid, width: 400"]
<tbody>[TR]
[TD][/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]boat[/TD]
[TD]green[/TD]
[TD]manual[/TD]
[/TR]
</tbody>[/TABLE]
Sheet6

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="class: grid, width: 100%"]
<tbody>[TR]
[TD="width: 10"]Cell[/TD]
[TD="align: left"]Formula[/TD]
[/TR]
[TR]
[TH="width: 10"]D2[/TH]
[TD="align: left"]=IF(C2="","",VLOOKUP(C2,Sheet5!A1:C2,2,0))[/TD]
[/TR]
[TR]
[TH="width: 10"]E2[/TH]
[TD="align: left"]=IF(C2="","",VLOOKUP(C2,Sheet5!A1:C2,3,0))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Great! It works as I need. Thx a lot!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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