+ Reply to Thread
Results 1 to 6 of 6

Error on Nested If Statement

  1. #1
    Registered User
    Join Date
    04-14-2010
    Location
    Minneapolis
    MS-Off Ver
    Excel 2007
    Posts
    12

    Error on Nested If Statement

    I'm having a lot of trouble with the IF statement I am attempting to use, and I cannot figure out for the life of me where my error is. Please take a look at the formula and help me find my error. Thank you!

    =IF(C2="Line 10",200,IF(OR(C2="Line 1","Line 5"),IF(AI>50,200,240,IF(OR(C2="Line 2","Line 4","Line 6","Line 3"),IF(a1>80,150,170,If(C2="Line 9",vlookup(95 Number,'Product Table'!N1:P309,3,FALSE))))))

  2. #2
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: Error on Nested If Statement

    Hi There - the Shaolin Masters of this Forum may be able to tell in a fleeting glance whats wrong with your formula but for the avg joe like me it'd b really helpful if u were to upload a spreadsheet.

    I bet Dll has responded already!
    Blake 7

    If your question has been answered, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If any member's response has helped to solve your problem, please consider using the scales icon on the top right of their post to show your appreciation.

    http://failblog.org/

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

    Re: Error on Nested If Statement

    Quote Originally Posted by Blake 7 View Post
    I bet Dll has responded already!
    Not quite......

    Try this

    =IF(C2="Line 10",200,IF(OR(C2={"Line 1","Line 5"}),IF(AI>50,200,240),IF(OR(C2={"Line 2","Line 4","Line 6","Line 3"}),IF(A1>80,150,170),IF(C2="Line 9",VLOOKUP("95 Number",'Product Table'!N1:P309,3,FALSE)))))

    I put quotes around "95 number" too.....is that right?
    Last edited by daddylonglegs; 02-18-2011 at 09:51 AM.
    Audere est facere

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Error on Nested If Statement

    Because of missing parentheses, your formula becomes a little ambigous so we're trying to guess what IF/Then, True/False senarios you're working with.

    I would put a parentheses after your first 240 and quotes around "95 number" Also, you have Ai>50, guessing that should be A1>50

    With complex IF statements like this I try to do some sort of flowchart to see if it's doing what I want it to do. See attached.

    One last thing, The VLOOKUP will always return the same thing assuming your Product table is static and "95 Number" is not a defined name. Is that what you want?

    And finally (okay, that wasn't the last thing), If you respond to false all the way through your IF statement (assuming you have 10 lines, then if line 7 or 8), you end up with "FALSE" in your cell. Did you want that?
    Attached Files Attached Files
    Last edited by ChemistB; 02-18-2011 at 11:40 AM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

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

    Re: Error on Nested If Statement

    Quote Originally Posted by ChemistB View Post
    Also, you have Ai>50, guessing that should be A1>50
    Good call

  6. #6
    Registered User
    Join Date
    04-14-2010
    Location
    Minneapolis
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Error on Nested If Statement

    Awesome - Thanks guys! It's now working the way I want it to

+ 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