+ Reply to Thread
Results 1 to 9 of 9

Horizontal Sort

  1. #1
    Registered User
    Join Date
    12-27-2013
    Location
    Savannah
    MS-Off Ver
    Excel 2010
    Posts
    4

    Exclamation Horizontal Sort

    Hi,

    I have a set of data that is over 2500 rows. It contains an ID column and then multiple tags associated with that ID that need to be sorted horizontally.
    As comma separated it would appear as the example below.

    Example:
    1, ACC.d, FAS.d, 2013-2014, GRD.d
    2, 2013-2014
    3, MTJ.w, FAS.d, ACC.d
    4, GRD.d, ACC.d

    I'd like to sort these horizontally for each row and maintain the spacing if possible. Is there a function/macro I can use? I am not very familiar with Macros, so the more detailed, the better...

    thanks
    jg
    Last edited by jgilliga; 12-27-2013 at 11:47 AM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Horizontal Sort

    Are you saying you want the entries in all the rows to line up? (i.e. all the "ACC.d" in col A, "FAS.d" in Col B, etc)? So given your example, in Row 3, MTJ.w might be the first entry in Col E? or are all the entries from row 2 down included in row 1?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    12-27-2013
    Location
    Savannah
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Horizontal Sort

    Ideally, the ID would remain in column A, 2013-2014 would populate in column B, ACC.d would list in column C, etc... there are up to as many as 9 tags for a given ID

    Thanks for your quick response.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Horizontal Sort

    How do I know what's the ID? Can you upload an example showing finished results (Go Advanced>Manage Attachments)

  5. #5
    Registered User
    Join Date
    12-27-2013
    Location
    Savannah
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Horizontal Sort

    in the example I simply listed them as 1, 2, 3, 4:
    Example:
    1, ACC.d, FAS.d, 2013-2014, GRD.d
    2, 2013-2014
    3, MTJ.w, FAS.d, ACC.d
    4, GRD.d, ACC.d

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,153

    Re: Horizontal Sort

    @jgilliga: simply repeating the same thing won't get any of us any closer to understanding a) what you start with and b) what you want to end up with.

    As ChemistB has suggested, please upload a sample workbook with typical data before it is sorted and a mock up of what it would look like after it is sorted.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Registered User
    Join Date
    12-27-2013
    Location
    Savannah
    MS-Off Ver
    Excel 2010
    Posts
    4

    Post Re: Horizontal Sort

    My apologies...
    I didn't realize that was repetitive. The answer that was not in the first post was that you, in fact, know what the ID is as it is ALWAYS in Column A. I'm sorry if that was unclear.
    Attached is a view of:
    • how it is exported (in theory as the data is confidential),
    • how I use 'text to columns' to separate, and
    • the ideal output


    thanks all!
    jg
    Attached Files Attached Files

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Horizontal Sort

    Hi jgilliga,

    Here's a routine that I got from an esteemed forum member a while back - I pasted your:
    "Tags Isolated via Data --> "Text to Columns"" in Range A1 of sheet 2 and the ran this:

    Please Login or Register  to view this content.
    Last edited by xladept; 12-27-2013 at 06:04 PM. Reason: Details
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Horizontal Sort

    Assuming the tags in question are only the 5 shown, run this macro with the data in columns A:B

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] sort horizontal
    By Marianus in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-05-2013, 05:24 AM
  2. Replies: 1
    Last Post: 04-26-2012, 08:34 PM
  3. Ignore empty cells when doing horizontal sort with VBA
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2012, 09:01 PM
  4. Horizontal Sort
    By ksusong in forum Excel General
    Replies: 2
    Last Post: 05-24-2006, 02:29 PM
  5. Horizontal sort??
    By wonderingAboutExcel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2006, 09:10 AM

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