Combination of IF & Vlookup, what will be the syntax ?

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
205
Office Version
  1. 2019
Platform
  1. Windows
In my sheet I want that IF H5 of Backend sheet will be matched with some text of D5 then it will search in a range of Data sheet.

I am trying for code that

=VLOOKUP(H5,IF(D5="CAR", ???? then it should search a range from the DATA sheet for the H5 if the D5 matches with text "CAR". what should be the code ??
 
The value of H5 is not certain, it will change but the value of H5 is there in the DATA sheet. the value of H5 is there in B column of Data sheet. I want the associated vertical data of D column of DATA sheet. so the normal Vlookup will be like this =VLOOKUP(H5,DATA!A1:F50,4,FALSE) but I want to add the If function, if the D5="CAR" then it will search a different range, then if D5=BIKE then it will search a different range & so on. if D5 not equal to CAR then result may be come zero.

Something like:

=VLOOKUP(H5,INDIRECT(D5),2,0)

This will work if the relevant ranges have been given appropriate names. For example, the range relevant for CAR should be name CAR, BIKE etc. Would this work for you?
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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