+ Reply to Thread
Results 1 to 7 of 7

If statement for a range of numbers

  1. #1
    Registered User
    Join Date
    08-28-2009
    Location
    Newport RI
    MS-Off Ver
    Excel 2003
    Posts
    2

    If statement for a range of numbers

    Hello,

    I have tried over and over to get a point value from the percentages posted below but my formula will not return consistent results. Am I doing something wrong.

    94% - below 1 Point
    95%-96% 2 Points
    97% 3 points
    98%-99% 4 Points
    0% or 100% 5 Points

    Reference Cell is AG2 and is .99 but for some reason I return a 5
    =IF(AG2=0,5,IF(AND(AG2>0,AG2<=0.94),1,IF(AND(AG2>=0.95,AG2<=0.96),2,IF(AG2=0.97,3,IF(AND(AG2>=0.98,AG2<=0.99),4,5)))))

    Please help
    Last edited by whalleyb; 08-28-2009 at 11:23 AM.

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

    Re: If statement for a range of numbers

    I haven't tested your formula, but you do have a space character in the range reference in the last argument: "A G2" should be AG2
    Last edited by Palmetto; 08-28-2009 at 11:09 AM.

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

    Re: If statement for a range of numbers

    Is AG2 coming from a formula? It may be > 0.99 and only displaying as 0.99. You'd need to use the ROUND function on the formula to make sure it's rounding to the same as the display. Otherwise it looks like it should work. Did that help?
    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

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: If statement for a range of numbers

    Try

    =Lookup(AG2,{0,.0001,.95,.97,.99,1},{5,1,2,3,4,5})
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

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

    Re: If statement for a range of numbers

    Quote Originally Posted by Palmetto
    I haven't tested your formula, but you do an a space character in the range reference in the last argument: "A G2" should be AG2
    FYI, For some reason the forum inserts a blank space every 50 characters (if there is none within the last 50). So not Whally's fault. Guess that's for readability.

  6. #6
    Registered User
    Join Date
    08-28-2009
    Location
    Newport RI
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: If statement for a range of numbers

    The lookup works perfectly, thank you so much

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: If statement for a range of numbers

    Please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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