Results 1 to 5 of 5

Thread: MS Excel putting numbers in order.

  1. #1
    Senior Member ben10's Avatar
    Join Date
    Jan 2008
    Posts
    646
    Thanks
    148
    Thanked 302 Times in 107 Posts
    Rep Power
    261
    Reputation
    2091

    Default MS Excel putting numbers in order.

    can someone give me a formula for excel to put these numbers in order when I paste them onto excel.

    example from this:

    2
    195
    67
    101
    47
    80 x 2
    194
    40
    7 x 3
    34 x 2
    85 x 3

    result would be:

    2
    7 x 3
    34 x 2
    40
    47
    67
    80 x 2
    85 x 3
    101
    194
    195

    thanks.



Look Here ->
  • #2
    LSemmens
    lsemmens's Avatar
    Join Date
    Dec 2011
    Location
    Rural South OZ
    Posts
    10,613
    Thanks
    11,898
    Thanked 7,075 Times in 3,347 Posts
    Rep Power
    3160
    Reputation
    132872

    Default

    Convert them all to text then your sort should work. I'm assuming those formulae are to remain as such and not the calculated result. Help in Excel is generally very good for simple tasks like this.

  • #3
    Senior Member ben10's Avatar
    Join Date
    Jan 2008
    Posts
    646
    Thanks
    148
    Thanked 302 Times in 107 Posts
    Rep Power
    261
    Reputation
    2091

    Default

    Quote Originally Posted by lsemmens View Post
    Convert them all to text then your sort should work. I'm assuming those formulae are to remain as such and not the calculated result. Help in Excel is generally very good for simple tasks like this.
    thanks for the quick reply.
    i just did that. covert whole column to text. then sort it. and the result is not what i wanted.
    2
    40
    47
    67
    101
    194
    195
    34 x 2
    7 x 3
    80 x 2
    85 x 3

  • #4
    Junior Member
    Join Date
    Jan 2008
    Posts
    30
    Thanks
    10
    Thanked 12 Times in 9 Posts
    Rep Power
    203
    Reputation
    197

    Default

    Here is an idea :

    1. Format all the cells as text (not really needed but it makes the data look "nicer" (all left justified)
    2. In the next column use the find function to search for a space in the cells as sorted eg "=+FIND(" ",B7)"
    3. Now, in the next column over, use =+IF(ISERR(C7),VALUE(B7),VALUE(LEFT(B7,C7))) to either get the value of the initial field when there is no space or get the value of the number up to the space
    4. Now sort the numbers by the column calculated in step 3

    Be careful that if your list has 2 data pieces which are the same up to the space, the results may not be perfect (eg 80 x 5 and 80 x 6 would not necessarily be sorted correctly) so you may have to do a sort on the original column as the "secondary" sorting value to get some predictable values.

    Start Data Location of Space Calc Result
    2 =+FIND(" ",B7) =+IF(ISERR(C7),VALUE(B7),VALUE(LEFT(B7,C7)))
    195 =+FIND(" ",B8) =+IF(ISERR(C8),VALUE(B8),VALUE(LEFT(B8,C8)))
    67 =+FIND(" ",B9) =+IF(ISERR(C9),VALUE(B9),VALUE(LEFT(B9,C9)))
    101 =+FIND(" ",B10) =+IF(ISERR(C10),VALUE(B10),VALUE(LEFT(B10,C10)))
    47 =+FIND(" ",B11) =+IF(ISERR(C11),VALUE(B11),VALUE(LEFT(B11,C11)))
    80 x 2 =+FIND(" ",B12) =+IF(ISERR(C12),VALUE(B12),VALUE(LEFT(B12,C12)))
    194 =+FIND(" ",B13) =+IF(ISERR(C13),VALUE(B13),VALUE(LEFT(B13,C13)))
    40 =+FIND(" ",B14) =+IF(ISERR(C14),VALUE(B14),VALUE(LEFT(B14,C14)))
    7 x 3 =+FIND(" ",B15) =+IF(ISERR(C15),VALUE(B15),VALUE(LEFT(B15,C15)))
    34 x 2 =+FIND(" ",B16) =+IF(ISERR(C16),VALUE(B16),VALUE(LEFT(B16,C16)))
    85 x 3 =+FIND(" ",B17) =+IF(ISERR(C17),VALUE(B17),VALUE(LEFT(B17,C17)))

    Clear as mud ???

    Hope this helps,

    Cheers,
    JG
    Last edited by jglnb; 12-07-14 at 05:13 PM.

  • The Following User Says Thank You to jglnb For This Useful Post:

    ben10 (14-07-14)

  • #5
    Senior Member
    Philquad's Avatar
    Join Date
    Jan 2008
    Location
    nelson bay
    Age
    55
    Posts
    3,872
    Thanks
    192
    Thanked 1,305 Times in 783 Posts
    Rep Power
    666
    Reputation
    16938

    Default

    just put it in 2 columns
    miss the x
    select it all, sort by custom, 1st row

    2
    7 3
    34 2
    40
    47
    67
    80 2
    85 3
    101
    194
    195

    or even 3 columns, put x in the middle one
    Last edited by Philquad; 12-07-14 at 05:47 PM.
    https://www.facebook.com/philquad68

  • The Following User Says Thank You to Philquad For This Useful Post:

    ben10 (14-07-14)

  • 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
    •