+ Reply to Thread
Results 1 to 5 of 5

Numbers With Letters Out of Sequence

  1. #1
    Registered User
    Join Date
    11-25-2011
    Location
    Liverpool, NY
    MS-Off Ver
    Excel 2003
    Posts
    2

    Numbers With Letters Out of Sequence

    I have to import room numbers from a text file into a excel spreadsheet at times. The rooms numbers will at times have letters attached to them. When I sort them they always end up separated from the main number instead of following the that number. For example: if I have room 200, 200A, 200B, 200C, etc. the 200 goes where it suppose to but the 200 with letters ends up towards the bottom of the column. How do I get the room numbers with letters to follow the main number instead of being separated from it? I have to do a cut & paste to get the numbers in order.
    Thanks in advance.

    LLm

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Numbers With Letters Out of Sequence

    Hi,

    Easiest way would be to split the numbers and letters into separate columns.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Numbers With Letters Out of Sequence

    format the column as Text.
    Add a space at the end to the numbers without a letter.
    Sort the column.



  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Numbers With Letters Out of Sequence

    Maybe try this:

    Put your numbers in Column A and in Column B put this formula:

    Please Login or Register  to view this content.
    and drag down.

    Now highlight both columns and sort by Column B. Excel will recognize that you might have some text and some that look like numbers and give you an option. Pick option #2 (Sort numbers and numbers stores as text separately).

    Hope this helps.

    abousetta
    Last edited by abousetta; 11-26-2011 at 09:29 AM. Reason: corrected formula
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

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

    Re: Numbers With Letters Out of Sequence

    try in b1
    =IF(ISNUMBER(--A1),TEXT(A1,"0000"),TEXT(LEFT(A1,LEN(A1)-1),"0000")&RIGHT(A1))
    then sort by column b
    "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

+ 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