+ Reply to Thread
Results 1 to 5 of 5

IFERROR and Multiple IF Statements Not Returning Expected Result

  1. #1
    Registered User
    Join Date
    07-02-2013
    Location
    Piedmont, USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    IFERROR and Multiple IF Statements Not Returning Expected Result

    I am using this formula in column C

    =IFERROR(VLOOKUP(B2,'NewData'!A:V,11,FALSE),"NA")

    I am using this formula in column D

    =IF(C2<=100,"1",IF(C2>300,"3",IF(C2>100,"2","NA")))

    It is failing to recognize the NA results and instead showing 3 as the result.

    What have I got wrong? Thank you.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: IFERROR and Multiple IF Statements Not Returning Expected Result

    hi eforsadoko, welcome to the forum. first question; why do you need to range up to Column V when you only need the 11th column?
    =IFERROR(VLOOKUP(B2,NewData!A:V,11,FALSE),"NA")

    text in excel are considered to be bigger than numbers. you can try somewhere:
    ="ABC">0

    so your first test of lesser or equals to 100 will fail. a text is greater than a number. it goes to the 2nd test where you put whether is it greater than 300. it is, so it returns "3". put it this way instead:
    =IF(C2="NA","NA",IF(C2<=100,1,IF(C2>300,2,100)))

    so only when it fails the first test, it will continue with the rest. also, you don't need double quotes for numbers:
    =IF(C2<=100,"1",IF(C2>300,"3",IF(C2>100,"2","NA")))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    07-02-2013
    Location
    Piedmont, USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: IFERROR and Multiple IF Statements Not Returning Expected Result

    Your solution is very fine. I tried it and it works save for one thing: if the field is blank it shows a 1. Do I need add something to cover a blank field?

  4. #4
    Registered User
    Join Date
    07-02-2013
    Location
    Piedmont, USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: IFERROR and Multiple IF Statements Not Returning Expected Result

    I ran into a some trouble with your formula so edited it:

    From
    =IF(C2="NA","NA",IF(C2<=100,1,IF(C2>300,2,100)))

    To:
    =IF(C2="NA","NA",IF(C2<=100,1,IF(C2>300,3,2)))

    It kept giving me 100s where not so.

  5. #5
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: IFERROR and Multiple IF Statements Not Returning Expected Result

    Yes, but what do you want it to return... NA or blank or something else?

    If NA...

    =IF(OR(C2="",C2="NA"),"NA",IF(C2<=100,1,IF(C2>300,3,2)))


    If blank...

    =IF(C2="","",IF(C2="NA","NA",IF(C2<=100,1,IF(C2>300,3,2))))

    If something else, put it between the second set of quotation marks (red ones) if textual... if number, replace the quotation marks with the number.

+ 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