+ Reply to Thread
Results 1 to 7 of 7

How to Sort Numerically prefixed alpha numeric rows by Number

  1. #1
    Registered User
    Join Date
    04-10-2012
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    16

    How to Sort Numerically prefixed alpha numeric rows by Number

    Hello,

    I have a macro that I am working on, and part of this macro sorts a group of project plans into several different cateogries. Then within these categories the project plans which contain a 5 digit numerical prefix project number and the name of the plan need to be sorted numerically in ascending order. I have tried this manually however it only sorts by alpha characters instead of the project numbers at the start of the alpha numeric string. I was wondering if anyone could give me any tips on a procedure I could use or how to go about solving this using vba. I have attached an example spreadsheet with tabs depicting the original format, manually sorted format, and the desired format.


    example_Desired_Effect(1).xls

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: How to Sort Numerically prefixed alpha numeric rows by Number

    Here's one way. See the attached example. The macro below (and in the workbook)inserts a column in A, pulls in the numeric portion of your characters and sorts by that, then deletes the column. Hope this helps.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to Sort Numerically prefixed alpha numeric rows by Number

    Try this
    Please Login or Register  to view this content.
    example_Desired.xls

  4. #4
    Registered User
    Join Date
    04-10-2012
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: How to Sort Numerically prefixed alpha numeric rows by Number

    Hi Jindon thanks, this over my head a little, however from what it looks like you are using the search function to check for a common attribute for each each to be seperated by. Now for my case this generic template will have these status texts uniquely driven, however I can use a "*" character to denote a common attribute to these sections. I have tried this however and it says, "No cells were found once it tries to populate the myAreas variable. If I am incorrect in understanding this would you be willing to let me know what the iserror and search functions do in this case? Thanks.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to Sort Numerically prefixed alpha numeric rows by Number

    Delete the line of

    Application.ScreenUpdating = False

    Then step through the code.

    You will see how it works.

  6. #6
    Registered User
    Join Date
    04-10-2012
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: How to Sort Numerically prefixed alpha numeric rows by Number

    Ok Thanks,

    I see, that it does search for the text "Status" and my assumption there was correct, however it appears it does not accept special characters in the search function. Is there a way to use this solution with 4 unique seperators that do not have a common attribute such as "Status"

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to Sort Numerically prefixed alpha numeric rows by Number

    Can you upload a small sample?

    I don't understand the meaning of "special characters".

+ 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