ISBLANK and IF inside a VLOOKUP

default_name

Board Regular
Joined
May 16, 2018
Messages
170
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
I have a table of information.
Let's call this Table 1.

Table 1
ABC
1Activity
TNumber
ID
2Training54465
3Exercise AABC111A91299
4Exercise BABC222B91300

<tbody>
</tbody>



This second table (let's call this Table 2) allows the user to select an Activity from a dropdown list (which has been created for column F).
The corresponding TNumber and ID numbers are filled in from the first table.

Table 2
FGH
1Activity
TNumber
ID
2Exercise BABC22B91300
3
4

<tbody>
</tbody>


It appears to be working great in instances where an Activity has a TNumber and an ID number.
However, in Activity cases (such as Training) where there is no TNumber (only an ID number), I want the corresponding cell in the Table 2 to display a dash/hyphen (as below in cell G3).

Table 2
FGH
1Activity
TNumber
ID
2Exercise BABC22B91300
3Training-54465
4

<tbody>
</tbody>

I figured that I could simply add an ISBLANK function with a conditional (IF) into the VLOOKUP function, but that doesn't seem to be working.
Here is how I have the TNumber cell coded (using the code inside G3 as an example).
Code:
=IF(F3="","",VLOOKUP(F3,$A$2:$C$4,IF(ISBLANK(2),"-",2)))
for the TNumber
Code:
=IF(F3="","",VLOOKUP(F3,$A$2:$C$4,IF(ISBLANK(3),"-",3)))
for the ID number

How can I make this work the way I am envisioning it?
Hope that makes sense.

Thanks in advance.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,214,601
Messages
6,120,462
Members
448,965
Latest member
grijken

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