+ Reply to Thread
Results 1 to 9 of 9

Number list to a hyphenated range

  1. #1
    Registered User
    Join Date
    06-22-2012
    Location
    Northwest
    MS-Off Ver
    Excel 2007/2010
    Posts
    15

    Number list to a hyphenated range

    I have a serial number list, in a column beginning with 001, and there are 100 rows. The last number is not 100, however, it is 108. There are breaks in this range.

    What is the best method to output into a cell a hyphenated range, ie. 001-009 and in another cell, the count of that determined range, 9. Then in a new cell, 011-025, with 15 being the count?

    Would prefer to use a function but macros are fine...

    The serial range will be constantly changing, up to this point I have entered all this data by hand.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Number list to a hyphenated range

    Maybe something like this? assuming A1 looks like 001-009
    =(RIGHT(A1,3)-LEFT(A1,3))+1

  3. #3
    Registered User
    Join Date
    06-22-2012
    Location
    Northwest
    MS-Off Ver
    Excel 2007/2010
    Posts
    15

    Re: Number list to a hyphenated range

    Here is an example of my serial ranges and the example output I would like to achieve
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Number list to a hyphenated range

    =countifs($a$1:$a$51,">=" & left(f3,7),$a$1:$a$51,"<=" &right(f3,7))

  5. #5
    Registered User
    Join Date
    06-22-2012
    Location
    Northwest
    MS-Off Ver
    Excel 2007/2010
    Posts
    15

    Re: Number list to a hyphenated range

    Quote Originally Posted by JieJenn View Post
    =countifs($a$1:$a$51,">=" & left(f3,7),$a$1:$a$51,"<=" &right(f3,7))
    This only gives me a count.

    See the previously attached spreadsheet. The list in column A is what I have as source data, the stuff to the right is my expected output. Hyphenated ranges, and when there's a break, it goes to the next line...

  6. #6
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Number list to a hyphenated range

    Have you "even try" the formula?
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-22-2012
    Location
    Northwest
    MS-Off Ver
    Excel 2007/2010
    Posts
    15

    Re: Number list to a hyphenated range

    Quote Originally Posted by JieJenn View Post
    Have you "even try" the formula?
    Yes. Like I said, it just gives the count, I am not sure how to get the other part, the ranges to the left of the counts on the spreadsheet...

  8. #8
    Registered User
    Join Date
    06-22-2012
    Location
    Northwest
    MS-Off Ver
    Excel 2007/2010
    Posts
    15

    Re: Number list to a hyphenated range

    Any help? I can get the count but I can't consolidate the data in column A like I've shown in the example

  9. #9
    Registered User
    Join Date
    06-22-2012
    Location
    Northwest
    MS-Off Ver
    Excel 2007/2010
    Posts
    15

    Re: Number list to a hyphenated range

    Anyone have ideas? I'm looking at various ways to do this... can't get the right method, though.

    You can see in the spreadsheet I supplied that I have highlight the start of a new range with yellow. I would like the yellow cells to be the first part of the range and the last white cell preceding the next yellow cell to be the last part of the range.

    So assume A1 is yellow, A10 is yellow, A19 is yellow and the last cell is A25
    I would like a cell C1 to indicate A1 to A9 as a hyphenated range with only the first and last numbers present, separate by a hyphen.
    Then cell C2 would have A10 to A18 in the same format.
    Cell C3 will have A19 to A25 in the same format, etc etc, for however long my range is.

+ 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