+ Reply to Thread
Results 1 to 3 of 3

sorting numbers in a column

  1. #1
    Registered User
    Join Date
    12-11-2005
    Posts
    4

    sorting numbers in a column

    Problem: The numbers I am sorting are composed of various numbers of integers, some having four digits, others five or six, and so on. I would like to have them sort by number regardless of number of digits. Will Excel let me do this?
    example: presently it looks like this:
    3004
    12001656
    530393505
    2200498378

    and I really want it to sort like this:
    12001656
    2200498378
    3004
    530393505

    Can this be done?

  2. #2
    Max
    Guest

    Re: sorting numbers in a column

    One way is to use a helper col to convert the col of numbers to text,
    then sort both cols by the helper col

    Assume the numbers are in A1 down
    Put in B1, copy down: =TEXT(A1,"@")
    Now sort both cols A & B by col B, ascending
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "kailuamike" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Problem: The numbers I am sorting are composed of various numbers of
    > integers, some having four digits, others five or six, and so on. I
    > would like to have them sort by number regardless of number of digits.
    > Will Excel let me do this?
    > example: presently it looks like this:
    > 3004
    > 12001656
    > 530393505
    > 2200498378
    >
    > and I really want it to sort like this:
    > 12001656
    > 2200498378
    > 3004
    > 530393505
    >
    > Can this be done?
    >
    >
    > --
    > kailuamike
    > ------------------------------------------------------------------------
    > kailuamike's Profile:

    http://www.excelforum.com/member.php...o&userid=29558
    > View this thread: http://www.excelforum.com/showthread...hreadid=494495
    >




  3. #3
    David McRitchie
    Guest

    Re: sorting numbers in a column

    Hi Kailua,
    A user defined function as follows will convert everything
    to text and allow for leading zeros which you have not shown.

    Function ShowAsText(cell) returns string
    ShowAsText = "'" & cell.text 'single quote within double quotes
    End Function

    B1 = ShowAsText(A1)
    or
    B1 = personal.xls!ShowAsText(A1)

    Would suggest formatting the B column as text, but the above
    function will precede by a single quote so you don't have to format
    as text before using the fill handle to fill down.
    ---
    HTH,
    David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
    My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
    Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

    "kailuamike" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Problem: The numbers I am sorting are composed of various numbers of
    > integers, some having four digits, others five or six, and so on. I
    > would like to have them sort by number regardless of number of digits.
    > Will Excel let me do this?
    > example: presently it looks like this:
    > 3004
    > 12001656
    > 530393505
    > 2200498378
    >
    > and I really want it to sort like this:
    > 12001656
    > 2200498378
    > 3004
    > 530393505
    >
    > Can this be done?
    >
    >
    > --
    > kailuamike
    > ------------------------------------------------------------------------
    > kailuamike's Profile: http://www.excelforum.com/member.php...o&userid=29558
    > View this thread: http://www.excelforum.com/showthread...hreadid=494495
    >




+ 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