+ Reply to Thread
Results 1 to 5 of 5

Sorting problem with large data set

  1. #1
    Registered User
    Join Date
    10-20-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    3

    Sorting problem with large data set

    Greetings!

    This seems like it should be such an easy fix and I'm sure it is, but I can't can't figure it out. I have a series of data that I want sorted. Howerver, Sorting gives me the odd result of the follow:

    0801952-1
    0801952-10
    0801952-11
    0801952-12
    0801952-13
    0801952-14
    0801952-15
    0801952-16
    0801952-17
    0801952-18
    0801952-19
    0801952-2
    0801952-20
    0801952-3
    0801952-4
    0801952-5
    0801952-6
    0801952-7
    0801952-8
    0801952-9

    Now I understand why it's doing it. But is there an easy way to fix this problem without going back into my data and making the trailing numbers -0X's? My set of data is near 1600 so you can understand why I don't want to try and fix this by hand.

    Thanks in advance for any help!

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Sorting problem with large data set

    In an adjacent column create revised versions, eg assuming trailing number is in range 1-999 then based on your sample:

    =LEFT(A1,FIND("-",A1))&TEXT(RIGHT(A1,LEN(A1)-FIND("-",A1)),"000")
    where A1 contains original (adjust 000 to meet requirements - ie if range 1-99999 then use 00000 etc...)

    Copy and paste results over formulae and sort by this column (or copy over original values if preferred)

  3. #3
    Registered User
    Join Date
    10-20-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Sorting problem with large data set

    Awesome, thanks!

    Is there a source I could read through to give me a better idea of what that formula is actually doing? I've never worked with the LEFT/RIGHT or FIND functions so I'd like to learn what is actually going on. Or if you have a moment to walk me though it that would be great also. But, I realise you probably have better things to be doing .

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Sorting problem with large data set

    Be sure to check out the XL help files on each.

    LEFT(text,numchars) -> returns specified numbers of chars from start of a text string

    RIGHT(text,numchars) -> as above but from the end of a text string

    FIND(find text, within text, [start num]) -> starting position of find text within "within text" with FIND searching "within text" from character specified as start num onwards ([start num] is optional - default 1)
    Note: find is case sensitive unlike Search ... irrelevant in this instance given a hyphen is not affected by case

    In essence the formula provided previously :

    a) Extracts the string up to and including hyphen.

    b) Takes the number that appears post hyphen and formats value to 000
    (ie 1 becomes 001, 10 becomes 010, 100 remains as before)

    c) Concatenates the two strings a) & b)
    Last edited by DonkeyOte; 10-20-2009 at 11:56 AM.

  5. #5
    Registered User
    Join Date
    10-20-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Sorting problem with large data set

    I just went through the formula peice by peice and figured it out myself. It's actually not as complex as I originally thought. Thanks again for such a quick and accurate responce!

+ 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