Help With VLookup Please
One suggested change to the VLOOKUP to handle the error you get when a part
number is not found in the master list:
Range("C2").FormulaR1C1 =
"=IF(ISERROR(VLOOKUP(RC[-1],Sheet2!C[-2]:C,3,FALSE)),"NOT
FOUND",VLOOKUP(RC[-1],Sheet2!C[-2]:C,3,FALSE))"
I might have a missing parenthesis or two or a comma in the wrong place, but
you get the idea - you want to do something for those cases where you get the
"#N/A" errors. If you don't want to put "NOT FOUND" in, you can put $0.0 or
something else instead.
HTH,
Eric
-------------------------
If toast always lands butter-side down, and cats always land on their feet,
what happen if you strap toast on the back of a cat and drop it?
Steven Wright (1955 - )
"Stefi" wrote:
Sub test()
Worksheets("Sheet1").Activate
NoOfRows = Range("B" & Rows.Count).End(xlUp).Row
Range("C2").FormulaR1C1 = "=VLOOKUP(RC[-1],Sheet2!C[-2]:C,3,FALSE)"
Range("C2").AutoFill Destination:=Range("C2:C" & NoOfRows),
Type:=xlFillDefault
End Sub
Regards,
Stefi
€žAndy€ť ezt Ă*rta:
HI Stefi
I was just showing some sample data. In fact there are a few thousand
rows. So there will be a match for 20900080 in Sheet2 somewhere. Can
you help me with the lookup code assuming that there will be a
match. :-)
Thanks
Andy
|