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))
 

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,385
Office Version
365
Platform
Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,102,867
Messages
5,489,363
Members
407,686
Latest member
Chuck1960

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top