+ Reply to Thread
Results 1 to 4 of 4

Nested If statement not working

Hybrid View

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    15

    Nested If statement not working

    OK...here is what I have:

    example.png

    The formula I used is:

    =IF(AO11<=.5999,F,IF(AND(AO11>.5999,AO11<=.6999),D,IF(AND(AO11>.6999,AO11<=.7999),C,IF(AND(AO11>.7999,AO11<=.8999),B,IF(AND(AO11>.8999,AO11<=1.000),A)))))

    I am trying to attach a letter grade to a percentage (A = 100-90, B = 89.99-80, C = 79.99-70, D = 69.99-60, F = 59.99-0)

    It tells me there is an error and highlights the "C" but I don't understand why it is an error.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Nested If statement not working

    text needs to be in quotes "c"
    Formula: copy to clipboard
    =IF(AO11<=0.5999,"F",IF(AND(AO11>0.5999,AO11<=0.6999),"D",IF(AND(AO11>0.6999,AO11<=0.7999),"C",IF(AND(AO11>0.7999,AO11<=0.8999),"B",IF(AND(AO11>0.8999,AO11<=1),"A")))))

    Youcould also use
    =IF(AO11="","",LOOKUP(A011*100,{0,60,70,80,90},{"F","D","C","B","A"}))
    or
    =IF(AO11="","",LOOKUP(A011,{0,0.6,0.7,0.8,0.9},{"F","D","C","B","A"}))
    Last edited by martindwilson; 11-08-2013 at 01:36 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    10-30-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Nested If statement not working

    Wow...I feel stupid now...I knew that and just missed it.

    Thanks!

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Nested If statement not working

    You might also consider using a small table and a vlookup instead of the nested IF()'s
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Simple nested IF statement not working correctly
    By bassemsaad in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-04-2013, 08:53 AM
  2. [SOLVED] Nested If Statement - ISBLANK and ISNA in same statement?
    By Janc in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-23-2013, 09:00 AM
  3. [SOLVED] Nested IF statement using Lookup is not working
    By DPKologie in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-22-2012, 07:36 PM
  4. nested IF statement not working
    By piquet2759 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-13-2009, 07:03 PM
  5. Replies: 6
    Last Post: 01-14-2009, 06:59 PM

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