Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 81
Default Using Iserror with If statement and Vlookup

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?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Using Iserror with If statement and Vlookup

Hi,

The way the formula is set up if 'steel' isn't in B2 it will return zero.
What will give an error is not find the value in B2 in the lookup range and
you can get around that by checking if the lookup value is there before
executing the vlookup

=IF(COUNTIF('Macos 12 Mo.
Data'!$A$4:$A$326,$B2)0,IF($K2="STEEL",VLOOKUP($B 2,'Macos 12 Mo.
Data'!$A$4:$AU$326,40,FALSE),0),"")


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"juliejg1" wrote:

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?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 81
Default Using Iserror with If statement and Vlookup


Thank you Mike....very helpful!


"Mike H" wrote:

Hi,

The way the formula is set up if 'steel' isn't in B2 it will return zero.
What will give an error is not find the value in B2 in the lookup range and
you can get around that by checking if the lookup value is there before
executing the vlookup

=IF(COUNTIF('Macos 12 Mo.
Data'!$A$4:$A$326,$B2)0,IF($K2="STEEL",VLOOKUP($B 2,'Macos 12 Mo.
Data'!$A$4:$AU$326,40,FALSE),0),"")


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"juliejg1" wrote:

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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
nested IF(ISERROR()) statement DC Excel Discussion (Misc queries) 13 May 31st 07 01:28 PM
Iserror nested within a conditional vlookup Dale Excel Worksheet Functions 3 January 5th 07 11:40 PM
Iserror and vlookup T De Villiers Excel Worksheet Functions 1 January 27th 06 05:00 PM
ISERROR VLOOKUP Carole O Excel Worksheet Functions 1 June 1st 05 02:08 AM
Iserror and Vlookup ShineboxNJ Excel Worksheet Functions 1 November 19th 04 12:31 AM


All times are GMT +1. The time now is 10:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"