+ Reply to Thread
Results 1 to 12 of 12

Sort problem - decimated number, alphas, AND parentheses

  1. #1
    Registered User
    Join Date
    04-13-2010
    Location
    Brooklyn, NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Sort problem - decimated number, alphas, AND parentheses

    Hi:

    I have a spreadsheet with a LONG column with values that look like this:

    119.49
    119.49
    119.43(a)
    119.43(a)
    119.43(a)
    119.43(a)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)(1)
    119.43(b)(1)
    119.43(b)(1)

    That I basically need to sort like this:

    119.43
    119.43(a)
    119.43(a)
    119.43(a)
    119.43(a)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)(1)
    119.43(b)(1)
    119.43(b)(1)
    119.43(b)(1)
    119.43(b)(1)
    119.43(b)(1)
    119.47
    119.47
    119.47

    I've tried doing this with Text-to-columns, concatenating values and then re-merging, etc. But I can't get it to work. Essentially the hierarchy should go like this:

    Decimated number, no parenthetical value first: 123.45
    Followed by: 123.45(a)
    Followed by: 123.45(a)(1)
    Followed by: 123.45(a)(2)
    Followed by: 123.46
    Followed by: 123.45(a)
    Followed by: 123.45(a)(1)
    Followed by: 123.45(b)

    And so on. This is proving to be a lot harder than I anticipated. Any help would be greatly appreciated.

    Thanks,

    -P

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sort problem - decimated number, alphas, AND parentheses

    try in another column =text(a2,"@"), drag down then use that col to sort by
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    04-13-2010
    Location
    Brooklyn, NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Sort problem - decimated number, alphas, AND parentheses

    First of all, thanks for responding.

    That's better, but it's treating my parenthetical values as secondary, like this:

    119.43
    119.47
    119.47
    119.47
    119.47
    119.47
    119.47
    119.47
    119.47
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.43(a)
    119.43(a)
    119.43(a)
    119.43(a)
    119.43(b)
    119.43(b)

    See how it's sorting the 'pure' number values first, then starting again at .43(a). I need it to sort like this:

    119.43
    119.43(a)
    119.43(a)(1)
    119.43(b)
    119.43(b)(1)
    119.47

    and so on. Any ideas? Thanks again.

    - P

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Sort problem - decimated number, alphas, AND parentheses

    Martin's suggestion works perfectly for me:
    Please Login or Register  to view this content.
    When prompted, select Sort numbers and numbers stored as text separately
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sort problem - decimated number, alphas, AND parentheses

    I think, if Martin's suggestion worked, then TEXT to COLUMNs should work too...

    i.e. select the column and go to Data|Text to columns.. skip to 3rd window and choose TEXT from the column data format area.

    Then sort and when prompted choose to sort numbers and numbers stored as text separately.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Registered User
    Join Date
    04-13-2010
    Location
    Brooklyn, NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Sort problem - decimated number, alphas, AND parentheses

    SHG:

    Not sure what's different about the way you're using Martin's formula and the way I'm using it, but this is what I'm getting:

    119.43
    119.47
    119.47
    119.47
    119.47
    119.47
    119.47
    119.47
    119.47
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.43(a)
    119.43(a)
    119.43(a)
    119.43(a)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)
    119.43(b)(1)
    119.43(b)(1)
    119.43(b)(1)
    119.43(b)(1)
    119.43(b)(1)
    119.43(b)(1)
    119.47(a)
    119.47(a)
    119.47(a)
    119.47(a)
    119.47(a)
    119.47(a)
    119.47(a)
    119.47(a)
    119.47(a)
    119.47(b)
    119.47(b)
    119.47(b)
    119.47(b)
    119.47(b)
    119.47(b)
    119.47(b)
    119.49(a)
    119.49(a)
    119.49(a)
    119.49(a)
    119.49(a)
    119.49(a)(1)
    119.49(a)(1)
    119.49(a)(10)
    119.49(a)(10)
    119.49(a)(10)
    119.49(a)(11)
    119.49(a)(12)
    119.49(a)(12)
    119.49(a)(12)
    119.49(a)(12)
    119.49(a)(13)
    119.49(a)(2)
    119.49(a)(2)
    119.49(a)(4)
    119.49(a)(4)
    119.49(a)(5)
    119.49(a)(5)
    119.49(a)(5)
    119.49(a)(6)
    119.49(a)(6)
    119.49(a)(6)
    119.49(a)(6)
    119.49(a)(6)
    119.49(a)(8)
    119.49(a)(8)
    119.49(a)(8)
    119.49(a)(9)
    119.49(a)(9)
    119.49(a)(9)
    119.49(a)(9)
    119.49(a)(9)

    As you can see it jumps from 119.43 to 119.47 before going to 119.43(a). I am using the formula and then sorting numbers and numbers stored as text separately.


    NBVC - This ALMOST works. The problem is that I'm getting 119.43(a) before I'm getting 119.43:

    119.43 (a)
    119.43 (a)
    119.43 (a)
    119.43 (a)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43

    Since the (a) is now in the second column after doing text-to-columns, it's not recognizing the null cell as coming first in the order before the (a). Same with the 3rd column.

    I appreciate everyone's help. if you have any more suggestions, I'm pretty stumped here, as you can see.

    P

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Sort problem - decimated number, alphas, AND parentheses

    I'm not sure there's more than one interpretation of Martin's suggestion. See attached.
    Attached Files Attached Files

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sort problem - decimated number, alphas, AND parentheses

    Quote Originally Posted by EKinevel View Post


    NBVC - This ALMOST works. The problem is that I'm getting 119.43(a) before I'm getting 119.43:

    119.43 (a)
    119.43 (a)
    119.43 (a)
    119.43 (a)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b) (1)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43 (b)
    119.43

    Since the (a) is now in the second column after doing text-to-columns, it's not recognizing the null cell as coming first in the order before the (a). Same with the 3rd column.

    P
    When doing text to columns, in first window, select delimited, then next, next again, then Text.. it should all stay in one column

    I always get 119.43 at top.... (ascending order sort)

  9. #9
    Registered User
    Join Date
    04-13-2010
    Location
    Brooklyn, NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Sort problem - decimated number, alphas, AND parentheses

    SHG:

    Unfortunately, the example in your scratch.xls is also not the way I'm looking for it. Your second column looks like this:

    119.43
    119.47
    119.47
    119.47
    119.47
    119.47
    119.47
    119.47
    119.47
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.49
    119.43(a)
    119.43(a)

    I need the 119.43(a) to appear BEFORE it increments to the next root number (in this case 119.47). Thanks though.

  10. #10
    Registered User
    Join Date
    04-13-2010
    Location
    Brooklyn, NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Sort problem - decimated number, alphas, AND parentheses

    NBVC:

    OK, that actually works a little better. My problem now becomes the numeric values in the second set of parentheses:

    119.49(a)(1)
    119.49(a)(1)
    119.49(a)(10)
    119.49(a)(10)
    119.49(a)(10)
    119.49(a)(11)
    119.49(a)(12)
    119.49(a)(12)
    119.49(a)(12)
    119.49(a)(12)
    119.49(a)(13)
    119.49(a)(2)
    119.49(a)(2)
    119.49(a)(4)
    119.49(a)(4)
    119.49(a)(5)
    119.49(a)(5)
    119.49(a)(5)
    119.49(a)(6)

    Since it's formatted as text, it's going to increment them as 1, 10, 11, 2, 20, 22, etc. instead of 1,2,3,4,etc. Any way around that you can think of? In other words, instead of the above, I need it to look like this:


    119.49(a)(1)
    119.49(a)(2)
    119.49(a)(3)
    119.49(a)(3)
    119.49(a)(4)
    119.49(a)(5)
    119.49(a)(6)
    119.49(a)(7)

    and so on. Thanks again.

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Sort problem - decimated number, alphas, AND parentheses

    Here's how it sorts when I do it:

    Please Login or Register  to view this content.

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sort problem - decimated number, alphas, AND parentheses

    and me same result
    Attached Files Attached Files

+ 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