Consulting

Results 1 to 5 of 5

Thread: Sort with Multiple columns using VBA

  1. #1

    Smile Sort with Multiple columns using VBA

    Hi

    I need to sort the data in excel using three columns
    .The data has to be sorted first by columnA and then by columnB in ascending order and then by Column C.IN ColumnC the first three characters has to be taken into consideration.Suppose we have ABC01 and AB001.Then the third character with the alphabet ie ABC01 should be placed ahead of AB001.

    Am able to sort the by coulumnA and ColumnB by Sorting them by ColumnC is bit confusing.
    Any ideas for that.






    ColumnA ColumnB ColumnC
    A 190 ABC01
    C 180 AB021
    C 180 ABC01
    B 180 AD236
    E 180 AV002


    The output should be



    ColumnA ColumnB ColumnC
    A 190 ABC01
    B 180 AD236
    C 180 ABC01
    C 180 AB021
    E 180 AV002



  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Welcome to VBAX
    You can post a sample workbook using Manage Attachments in the Go Advanced reply section.
    It looks as though you may need to created a "Helper" column in the format xxx### to allow sorting on consistent data.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Hi mdmackillop

    Thanks for the warm welcome.

    I have attached a sample Excel consisting input table and the output table that i need.

    Please let me know for further information

    Thanks
    Srini
    Attached Files Attached Files

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Something like the attached, sort on columns A-C
    Attached Files Attached Files
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Hi mdmackillop

    Thanks you.yeah that almost what i need. Can the process be made using excel vba code for a column.

    Thanks
    Srini

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •