Consulting

Results 1 to 5 of 5

Thread: Solved: Nested IF function

  1. #1
    VBAX Tutor
    Joined
    Feb 2008
    Location
    New York
    Posts
    215
    Location

    Solved: Nested IF function

    Hi,

    In the attached table, I need to compare two corresponding data and need to determine if the data increased, decreased or remained the same. I used "If" function like this:

    IF(B2>A2,"Increased",IF(B2<A2,"Decreased",IF(B2=A2,"No change","Check!")))
    The problem with my data is that some of the data has text instead of number which is "ND". What I am looking for is, can the IF function somehow consider ND as "0" and then perform the calculation because I got a error with my current function when there was "ND" in one of the cell (please see C11, the data should have been "Decreased").

    Can someone help? Thanks.
    -u

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    tRY

    =IF(N(B2)>N(A2),"Increased",IF(N(B2)<N(A2),"Decreased","No change"))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Tutor
    Joined
    Feb 2008
    Location
    New York
    Posts
    215
    Location
    Hi xld,

    That worked, thank you very much sir.

    Question, how did "n" in the formula changed the function?
    -u

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    It takes the numeric value, which is zero for text.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Tutor
    Joined
    Feb 2008
    Location
    New York
    Posts
    215
    Location
    Great! Thanks
    -u

Posting Permissions

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