# VLOOKUP query

#### thewiseguy

##### Well-known Member
Hi everyone,

I have a VLOOKUP which is working just fine. However, I need to add another function to this formula and I'm not sure if it can be done through a VLOOKUP.

Lets call the existing VLOOKUP, VLOOKUP-A.
I am going to add a VLOOKUP, called VLOOKUP-B.

I want my formula to look into cell A1 and if the value is "T" then I want to use VLOOKUP-A.
If the value in A1 is "W" then I want to use VLOOKUP-B.

I hope this is clear and any help is greatly appreciated.

-twg

### Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

#### lenze

##### Legend
Should be simple enough!
Code:
``=IF(A1="T",VLOOKUP-A,VLOOKUP-B)``

lenze

#### thewiseguy

##### Well-known Member
Should be simple enough!
Code:
``=IF(A1="T",VLOOKUP-A,VLOOKUP-B)``

lenze

hi lenze...i dont think i worded my issue correctly. when i say "VLOOKUP-A" and VLOOKUP-B" i mean that those formulas already have variables in them.

Here is VLOOKUP-A:

=IF(ISERROR(VLOOKUP(B10,WHOLE,7,FALSE)),"",VLOOKUP(B10,WHOLE,7,FALSE))

VLOOKUP -B is going to be:

=IF(ISERROR(VLOOKUP(B10,WHOLE,8,FALSE)),"",VLOOKUP(B10,WHOLE,8,FALSE))

So when cell A1 = "T", i want my active cell to return the formula in VLOOKUP-A
when cell A1 = "W" I want my active cell to return the formula in VLOOKUP-B

#### lenze

##### Legend
So:
Code:
``=IF(A1="T",IF(ISERROR(VLOOKUP(B10,WHOLE,7,FALSE)),"",VLOOKUP(B10,WHOLE,7,FALSE)),IF(ISERROR(VLOOKUP(B10,WHOLE,8,FALSE)),"",VLOOKUP(B10,WHOLE,8,FALSE)))``

lenze

#### barry houdini

##### MrExcel MVP
Perhaps try....

=IF(ISNA(VLOOKUP(B10,WHOLE,8-(A1="T"),FALSE)),"",VLOOKUP(B10,WHOLE,8-(A1="T"),FALSE))

#### thewiseguy

##### Well-known Member
So:
Code:
``=IF(A1="T",IF(ISERROR(VLOOKUP(B10,WHOLE,7,FALSE)),"",VLOOKUP(B10,WHOLE,7,FALSE)),IF(ISERROR(VLOOKUP(B10,WHOLE,8,FALSE)),"",VLOOKUP(B10,WHOLE,8,FALSE)))``

lenze

THX lenze, that worked perfectly!

Replies
21
Views
645
Replies
4
Views
256
Replies
3
Views
239
Replies
6
Views
130
Replies
1
Views
184

1,190,782
Messages
5,982,878
Members
439,803
Latest member
sushilneupane

### 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.

### Which adblocker are you using?

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

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