I want to add 4 IF statements to an existing vlookup in my VBA code, but Im having a hard time figuring out how. I can write formulas, but I am very new to VBA
The formulas are
=IF(B1=B2,"Y","N")
=IF(AND(K2="Y",J1<>J2),"NOT OK","OK")
=IF(AND(K2="START BIN",OR(AND(B2=B3,L3="NOT OK"),(AND(B2=B4,L4="NOT OK")),(AND(B2=B5,L5="NOT OK")),(AND(B2=B6,L6="NOT OK")),(AND(B2=B7,L7="NOT OK")))),"MISMATCH"," ")
=IF(OR(M2="MISMATCH",AND(B2=B1,N1="SELECT BIN")),"SELECT BIN"," ")
Each formula will start on row 2 (same sheet) and I want to populate all the way down the column where data is present (each import has different # of rows)
my vlookup code from one sheet to another below works great, but I cant figure out where to start to add the if statements. Any help would be appreciated.
Sub formulas()
With Sheets("Sheet1").Range("G2", Sheets("Sheet").Cells(Rows.Count, "G").End(xlUp))
.Offset(, 3).Formula = "=VLOOKUP(G" & .Row & ",'sheet2'!$A:$D,3,FALSE)"
.Offset(, 3).Value = .Offset(, 3).Value
End With
End Sub