View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Luke M[_4_] Luke M[_4_] is offline
external usenet poster
 
Posts: 457
Default Using Iserror with If statement and Vlookup

An error would occur if the VLOOKUP can not find a result. Perhaps this:
=IF($K2="STEEL",IF(ISERROR(VLOOKUP($B2,'Macos 12 Mo.
Data'!$A$4:$AU$326,40,FALSE)),0,VLOOKUP($B2,'Macos 12 Mo.
Data'!$A$4:$AU$326,40,FALSE)),0)

or

=IF(OR($K2<"STEEL",ISERROR(VLOOKUP($B2,'Macos 12 Mo.
Data'!$A$4:$AU$326,40,FALSE))),0,VLOOKUP($B2,'Maco s 12 Mo.
Data'!$A$4:$AU$326,40,FALSE))

--
Best Regards,

Luke M
"juliejg1" wrote in message
...
I have the following formula in a cell:
=IF($K2="STEEL",VLOOKUP($B2,'Macos 12 Mo. Data'!$A$4:$AU$326,40,FALSE),0)

Problem is that the results of this are used for calculations and K2
sometimes doesn't equal "STEEL" so I get an error. I've tried putting an
Iserror and have the error = 0 but am doing something wrong. Can you
help?