+ Reply to Thread
Results 1 to 10 of 10

Replace individual numbers with a number range value

  1. #1
    Registered User
    Join Date
    01-15-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    40

    Replace individual numbers with a number range value

    I have a column of individual numbers ranging between 1 and 250.

    I need to conform these numbers to specific values. So for example, I need to replace any number between 1 and 10 with the value "1-10", any number between 11 and 20 with "11-20", etc.

    Is there any easy way to do this?

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

    Re: Replace individual numbers with a number range value

    In a spearte column use

    =IF(MOD(A1,10)=0,A1-9,FLOOR(A1,10)+1)&"-"&CEILING(A1,10)

    Copy down.

    Copy this column and paste special values onto original data
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,461

    Re: Replace individual numbers with a number range value

    Perhaps
    Please Login or Register  to view this content.
    and pull down as needed

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Replace individual numbers with a number range value

    @ Pepe:
    very nice. but i think the 10th values are all wrong. maybe:
    =INT((A1-1)/10)*10+1&"-"&(INT((A1-1)/10)+1)*10

    an alternative, AKM1:
    =FLOOR(A1-1,10)+1&"-"&CEILING(A1,10)
    Last edited by benishiryo; 03-21-2013 at 10:23 AM. Reason: additional info

    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
    Registered User
    Join Date
    01-15-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    40

    Re: Replace individual numbers with a number range value

    Thanks guys. I should have clarified that not all the ranges are increments of 10. Is there a way to specify the ranges?

  6. #6
    Registered User
    Join Date
    01-15-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    40

    Re: Replace individual numbers with a number range value

    Is this possible?

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,461

    Re: Replace individual numbers with a number range value

    Could you please specify which these ranges are?

  8. #8
    Registered User
    Join Date
    01-15-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    40

    Re: Replace individual numbers with a number range value

    Here are the ranges:

    2-9
    10-20
    21-50
    51-100
    101-500
    501+

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

    Re: Replace individual numbers with a number range value

    =lookup(a1,{2,10,21,51,101,501},{"2-9","10-20","21-50","51-100","101-500","500+"})

  10. #10
    Registered User
    Join Date
    01-15-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    40

    Re: Replace individual numbers with a number range value

    Thank you, kind sir!

+ 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