Using IF function with VLOOKUP for VBA

stemhel

New Member
Joined
Jul 19, 2019
Messages
1
I currently have an excel field using a formula and data validation. The formula is an IF statement that looks for any text from one cell(ie equipment part number) and then applies a VLOOKUP to find the name of the equipment. Based on the output of the VLOOKUP there is a data validation for a list to select either New or Used + Equipment type. All this is happening inside a table and I am having issues with the IF/VLOOKUP formula not auto-copying to a new row when new information is added. The data validation copies down to the new table row but not the formula. I am wanting to create a macro that applies to the entire Column that executes the formula function.

example of the formula
=IF(J2="","",VLOOKUP(J2,Parts!$A:$B,2,FALSE))
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
The formula does copy down inside a table

Use this notation (PartNo is the header in column J)

=IF([@PartNo]="","",VLOOKUP([@PartNo],Parts!A:B,2,0))

Excel 2016 (Windows) 32 bit
A
B
C
D
E
F
G
H
I
J
K
L
1
ABCDEFGHIPartNoTypeformula in column K
2
20/07/2019​
54​
70​
30​
81​
17​
51​
31​
15​
Part001a=IF([@PartNo]="","",VLOOKUP([@PartNo],Parts!A:B,2,0))
3
20/07/2019​
10​
42​
16​
71​
92​
27​
88​
72​
Part002b=IF([@PartNo]="","",VLOOKUP([@PartNo],Parts!A:B,2,0))
Sheet: Sheet1
 
Upvote 0

Forum statistics

Threads
1,214,556
Messages
6,120,190
Members
448,949
Latest member
keycalinc

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