+ Reply to Thread
Results 1 to 12 of 12

If Value in cell is between X and Y return Z

  1. #1
    Registered User
    Join Date
    03-07-2012
    Location
    Londinium
    MS-Off Ver
    Excel 2007
    Posts
    13

    If Value in cell is between X and Y return Z

    Hi There,

    In one column I have a range of percentages and I would like to bucket the 20%s as 20%, and if the value is between 30 and 39% bucket it as 30% and so on.
    An example of my formula which does not work looks like this.

    =IF(AND(V8>=0.2,V8<0.29),"20%",IF(AND(V8>=0.3,V8<0.39),"30%",0))

    and my values are in this format 46.4285714285714%.

    Any help on this would be greatly appreciated.

    Regards
    RichG

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: If Value in cell is between X and Y return Z

    Why not use ROUNDDOWN?

    =ROUNDDOWN(V8,2)
    Click on star (*) below if this helps

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

    Re: If Value in cell is between X and Y return Z

    Why is your formula not working? If the value in V8 is a number formatted as percentage, your formula should work. Is it possible V8 is text?

    Another formula that would work

    =ROUNDDOWN(V8,1)
    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 Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: If Value in cell is between X and Y return Z

    hi RichG, or maybe:
    =FLOOR(V8,0.1)

    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

  5. #5
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: If Value in cell is between X and Y return Z

    ChemistB:

    ROUNDDOWN should have a ,2 not ,1 ie, =ROUNDDOWN(V8,2)

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

    Re: If Value in cell is between X and Y return Z

    @K m
    If the values are formatted as percents and he wants 20, 30, etc then that would be single decimal.

  7. #7
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: If Value in cell is between X and Y return Z

    ChemistB: Sorry, you are correct. I should have reread the original post

  8. #8
    Registered User
    Join Date
    03-07-2012
    Location
    Londinium
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: If Value in cell is between X and Y return Z

    Hi guys thanks for the tips on the ROUNDOWN...

    But know I think the formula is wrong. (HARUMPHHH)
    It will only return 40% for percentages that are between 40% and 49%. Any thing above or below this returns a zero.

    I have tried this one below but no luck
    =IF(AND(V8>=0.2,V8<0.29),"20%",IF(AND(V8>=0.3,V8<0.39),"30%",IF(AND(V8>=0.4,V8<0.49),"40%",0))).

    Just to confirm if the value is 23.56% it should return 20%
    If the value is 38.25% it should return 30%

    It would be great to have an extra set of eyes on this as I have been pondering a solution to this all day.

    Regards
    RichG

  9. #9
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: If Value in cell is between X and Y return Z

    Rounddown does work for any value not just 40%. Don't know what your problem is

    =ROUNDDOWN(.2356,1) returns .20 or 20%

    =ROUNDDOWN(.3825,1) returns .30 or 30%
    Last edited by K m; 01-23-2013 at 11:29 AM.

  10. #10
    Registered User
    Join Date
    03-07-2012
    Location
    Londinium
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: If Value in cell is between X and Y return Z

    Hi K m

    Does the syntax for the if formula look right to you?

    Thanks
    RichG

  11. #11
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: If Value in cell is between X and Y return Z

    Why use IF formula if ROUNDDOWN works?

  12. #12
    Registered User
    Join Date
    03-07-2012
    Location
    Londinium
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: If Value in cell is between X and Y return Z

    Because I like to over complicate things :-P Its my superpower you know.

    Sorry about that, it's a bad habit I am trying to get out off.

    Thanks for your help and patience. I will sheepishly change the status to SOLVED.

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

    Re: If Value in cell is between X and Y return Z

    FYI
    =IF(AND(V8>=0.2,V8<0.29),"20%",IF(AND(V8>=0.3,V8<0.39),"30%",IF(AND(V8>=0.4,V8<0.49),"40%",0)))

    First off, your percents should not be in Quotes. Excel will see them as text. Also, you need your < values to be <=. So

    =IF(AND(V8>=0.2,V8<=0.29),20%,IF(AND(V8>=0.3,V8<=0.39),30%,IF(AND(V8>=0.4,V8<=0.49),40%,0)))
    Hope that helps.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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