+ Reply to Thread
Results 1 to 16 of 16

Macro to Sort Column Contents So That All Data Lines Up Accordingly

  1. #1
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Macro to Sort Column Contents So That All Data Lines Up Accordingly

    The attached workbook is laid out as follows: Blue section is unsorted data, Green and Red Sections are Columns A & B split up using Text to Column feature. Looking at the green columns, you can see that there is a lot of repetitive data, but it's scattered. I'm trying to get the similar information in one column. Example: "B7" is in about three or four different columns. I want to try getting it in one. Is there a macro that can do this? Not just for B7, but for all "like data". Would greatly appreciate the help. Tks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    I want to try getting it in one.
    Is it to merge column A and B ???
    Please give an example of the final result
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    Please see attached. Using "B8" as an example. I have highlighted the various locations that it's located in the workbook, then moved them all to Column T as a representation of how I would like to organize it, all in one column. Tks.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    With one added request...this function is intended to be used for thousands of rows of data. So, it would need function in a manner, most likely by column. Because doing it cell by cell would be too time consuming. Thanks for your time.

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    So that means we need to make the exhaustive list of values ( B7, B8, STUD, BOLT ...) from the split columns (Green columns) then some where to prepare a column for each value in the list and point out in this columns when it exist in a row ???
    It make a lot of columns no ??

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    In your example ( which is welcome) why B8T do not have its own column like B8 ?

  7. #7
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    Let me try another approach at this. Please see attached workbook. Is something like this possible, but on a larger scale? Tks. And regarding the B8/B8T, there's not a simple answer for it. It's an internal thing on my end. They're both considered the same. Thanks for your help.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    The swap has to be done in the green columns ??

  9. #9
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    I was using the green columns as my Test area to try to do this if that's what you're asking.

  10. #10
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    Here we go. New workbook attached. This is what I'm after. Thanks for the help.
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    So it means we can do the swap directly into columns A, B, C ...!
    With the same recommandation you mentioned: See thread #4

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    Is it what you want ???
    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    If you select the leading column or two adjacent columns, this will switch them including the headers:

    Please Login or Register  to view this content.
    Last edited by xladept; 08-22-2018 at 12:36 PM.
    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

  14. #14
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    I think this might do the trick. Thank you both for your help.

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

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    You're welcome and thanks for the rep!

  16. #16
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Macro to Sort Column Contents So That All Data Lines Up Accordingly

    Good news and us informed.
    Thx for the rep and enjoy Excel

+ 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] Macro to remove lines in Data set if Column A value is blank
    By sx200n in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-03-2017, 06:39 AM
  2. Sort by certain column if certain cell contents change
    By Smeghead in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-20-2015, 07:15 AM
  3. Replies: 1
    Last Post: 03-04-2015, 02:57 PM
  4. [SOLVED] Looking for a macro/VBA that can data group rang of lines based on cells contents
    By Zadok in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-02-2012, 12:05 AM
  5. Macro to transpose one column into multiple rows over MANY lines of data?
    By mtc in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 06-24-2012, 10:34 PM
  6. Replies: 3
    Last Post: 04-11-2012, 11:00 AM
  7. [SOLVED] Sort Data by Comment Contents / VB Macro
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-03-2009, 04:59 PM

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