+ Reply to Thread
Results 1 to 3 of 3

IF AND Formula for range created...Why is decimal number not recognized

  1. #1
    Registered User
    Join Date
    02-19-2014
    Location
    Atlanta
    MS-Off Ver
    Excel 2010
    Posts
    4

    IF AND Formula for range created...Why is decimal number not recognized

    Good Afternoon,

    Hope someone has a better eye than me today. I am missing something and I just don't see it. I have created a formula to return a specific text value if the number in a cell is within a range. i.e.,

    A1 is input cell. Range is 0-48 = "A", 49-59 = "B", 60-70 = "C", 71-81 = "D", 82+ = "F"

    My formula is: =IF(AND(A1<=48,A1>=0),"A",IF(AND(A1<=59, A1>=49),"B", IF(AND(A1<=70, A1>=60),"C",IF(AND(A1<=81,A1>=71),"D", "F")))).

    For the most part it works but when I enter 59.2 in A1 I get "F". If I enter 59.0 in A1 I get "B". Shouldn't 59.2 be recognized as 59. If I enter 58.7 I get "B". Please help!!!

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: IF AND Formula for range created...Why is decimal number not recognized

    Your formula does not account for the decimals in between ranges, hence gives the residual "F" value.

    Try

    =LOOKUP(A1,{0,49,60,71,82},{"A","B","C","D","F"})
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: IF AND Formula for range created...Why is decimal number not recognized

    Create a table like this:

    Data Range
    C
    D
    E
    1
    From
    To
    Grade
    2
    0
    48
    A
    3
    49
    59
    B
    4
    60
    70
    C
    5
    71
    81
    D
    6
    82
    82+
    F


    Then the formula would be:

    =LOOKUP(A1,C1:E6)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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] copy number with 3 or more decimal places and paste the actual value as 2 decimal number
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-29-2013, 12:57 AM
  2. Replies: 2
    Last Post: 10-03-2012, 03:38 PM
  3. Replies: 2
    Last Post: 06-29-2012, 07:52 PM
  4. [SOLVED] Convert formula to range name that is recognized by vlookup formua
    By r wilcox in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2006, 11:10 AM
  5. Convert formula to range name that is recognized by vlookup formua
    By r wilcox in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2006, 11:05 AM

Tags for this Thread

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