+ Reply to Thread
Results 1 to 13 of 13

How to treat "#N/A"s in IF functions

  1. #1
    Registered User
    Join Date
    06-23-2009
    Location
    Chicago, USA
    MS-Off Ver
    Excel 2003
    Posts
    11

    How to treat "#N/A"s in IF functions

    I've got two columns of data. I'm trying to test if either cell has a value greater than 0 to return a output. Say, in this example "has dividend". My problem is with #NA cells. Is there a way to ignore null values?

    I've also got some cells in the data that contain "#VALUE!". What is the basic difference between #VALUE and #NA?

    Thanks for the help!

  2. #2
    Forum Contributor
    Join Date
    08-14-2008
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: How to treat "#N/A"s in IF functions

    VALUE errors usually occur from incorrect argument type, ie. using a string where numbers are required.

    N/A errors mean literally "No Value available"


    you can use the function ISERR() to check if a cell contains an error message.

    for example:
    =IF(iserr(A1),"",A1)

  3. #3
    Forum Contributor
    Join Date
    08-14-2008
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: How to treat "#N/A"s in IF functions

    Sorry Geoff, just reread your post.

    This would be more like what you are after:

    =IF(ISERR(A1),"",IF(A1=0,"","had dividend"))

  4. #4
    Forum Contributor
    Join Date
    08-14-2008
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: How to treat "#N/A"s in IF functions

    Sorry, another ammendment:

    The ISERR function will work for all errors EXCEPT N/A.

    You will need to replace ISERR with ISERROR, which should work

  5. #5
    Registered User
    Join Date
    05-06-2009
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: How to treat "#N/A"s in IF functions

    I always understood #VALUE! to be "doesn't make sense" and #NA to mean "can not find".
    You'll get a value for instance, if you try to multiply "1" and "two". Excel doesn't recognize "two" as something that can be multiplied.
    #NA means that Excel couldn't find the answer. I honestly don't understand how an if statement could come back with an NA...

    You can use ISERROR along with an if to get rid of any "#" results.

    An example would be a great help to understand where you are having your problem.


    --- sorry folks... was typing this and didn't realize other people were responding at the same time!!

  6. #6
    Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    MS Office 2013
    Posts
    533

    Re: How to treat "#N/A"s in IF functions

    Normally #NA error occurred when vlookup(), match() etc. couldn't find the exact match then return #NA error. Although you can easily avoid it.
    Value Error occurred when you are adding string + number e.g. A1=hello & B1=12 and in C2 You write A1+B1 then result will be #Value ....
    you can ignore then #NA error by using ISNA() function as well but it totally depend what actually problem you have. you can give small example that what kind of formula's you have in those cells which are giving errors .....
    If this post helps, Please don't 4get to click the star icon located at the bottom left of my Post.

  7. #7
    Registered User
    Join Date
    06-23-2009
    Location
    Chicago, USA
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: How to treat "#N/A"s in IF functions

    Sorry sorry, should have given a clearer example.

    A1 has say "0", B1 has "#Value (or #NA)", I want C1 to output "no dividend". If either A1 or B1 contain a value greater than 0, regardless of the other cell, then i want the output to be "dividend".

    I'm tinkering.

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: How to treat "#N/A"s in IF functions

    I'm assuming that you won't have negative values in either cell, in which case

    =IF(SUMIF(A1:B1,">0"),"dividend","no dividend")

  9. #9
    Registered User
    Join Date
    06-23-2009
    Location
    Chicago, USA
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: How to treat "#N/A"s in IF functions

    =IF(SUMIF(A1:B1,">0"),"dividend","no dividend")

    has errors when there is a "#N/A" in A1 or B1. It outputs "no dividend" when there is an amount over 0 in A1 or B1.

  10. #10
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: How to treat "#N/A"s in IF functions

    Perhpas test for errors in each cell with a nest IF?

    =IF(AND(SUMIF(A1:B1,">0"),NOT(ISERROR(A1)),NOT(ISERROR(B1))),"dividend",IF(AND(SUMIF(A1:B1,"<=0"),NOT(ISERROR(A1)),NOT(ISERROR(B1))),"no dividend",""))

  11. #11
    Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    MS Office 2013
    Posts
    533

    Re: How to treat "#N/A"s in IF functions

    A simple approcah if you just want to divide ..... So whenever A or B has a value to be dividedned they will be divided ......

    =IF(ISERROR(A1/B1),"No Dividend","Dividend")

  12. #12
    Forum Contributor
    Join Date
    08-14-2008
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: How to treat "#N/A"s in IF functions

    Geoff, how about this:

    =IF(OR(ISERROR(B1),ISERROR(A1)),"No Dividend",IF(OR(B1=0,A1=0),"No Dividend","Dividend"))

  13. #13
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: How to treat "#N/A"s in IF functions

    Quote Originally Posted by Geoff1184 View Post
    =IF(SUMIF(A1:B1,">0"),"dividend","no dividend")

    has errors when there is a "#N/A" in A1 or B1. It outputs "no dividend" when there is an amount over 0 in A1 or B1.
    That can only happen if your "amount" is text formatted. What generates the values in A1 and B1? If these are from formulas then you could amend the formulas to ensure that values are numeric and then the above would work. Even better would be to amend the formulas so that error values are also suppressed......

    If you can't change the data try like this:

    =IF(IF(ISNUMBER(A1+0),IF(A1+0>0,1))+IF(ISNUMBER(B1+0),IF(B1+0>0,1)),"dividend","no dividend")

    or an "array formula"

    =IF(SUM(IF(ISNUMBER(A1:B1+0),IF(A1:B1+0>0,1))),"dividend","no dividend")

    which needs to be confirmed with CTRL+SHIFT+ENTER

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1