+ Reply to Thread
Results 1 to 9 of 9

Sort Part of a List

  1. #1
    Registered User
    Join Date
    09-29-2006
    Posts
    15

    Sort Part of a List

    I am an advanced user, so don't baby it for me. Maybe I'm just brain farting, but I can't seem to do this with the GUI. I could program some lengthy array sorting and re-organizing to do it, but there has to be another way.

    Quick version of problem: Given a table of 100 rows, only select 10 rows and sort those 10 alphabetically while leaving the other 90 exactly where/as they are.

    Detailed Issue:


    C1 - C2
    aa - bc
    ab - bb
    ac - bd
    ad -
    ae - bb
    af -
    ag - bb


    I have the above two columns. Column 1 has names in alphabetical order, and column 2 has an identifier or Nothing. Very basic. I want the outcome to be the following:


    C1 - C2
    aa - bc
    ab - bb
    ac - bd
    ae - bb
    ag - bb
    ad -
    af -


    I want column 1 sorted alphabetically grouped with column 2 data, so the top half of the table has alphabetical (A-Z) with data in column 2, then the bottom half has alphabetical (A-Z again) data with no data in column 2. With my logic, I should be able to sort Column 2, which temporarily makes it alphabetical and ignores column 1.... then I select ONLY the data in Column 1 from row 1 to row countCol2Rows, and sort that selection alphabetically. However... when I sort just that selection alphabetically, the entire "active range" is sorted. It should all be one table, I can't make this two tables.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Sort Part of a List

    That's the exact result I get with a single two-column sort, sorting by C2 and C1 in that order.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    09-29-2006
    Posts
    15

    Re: Sort Part of a List

    I have to admit, I didn't think of Two-Column Sort. But that isn't working properly either. I'll post why in a moment.
    Last edited by Suamere; 08-22-2011 at 01:36 PM.

  4. #4
    Registered User
    Join Date
    09-29-2006
    Posts
    15

    Re: Sort Part of a List

    The reason why is that it is keeping Column B sorted. Column A is not alphabetical for the overall list, it is only alphabetical for each set of like-data in column B. Two-Column sort first sorts the first column, then sorts any grouped values in the second column.

    ab - bb
    ae - bb
    ag - bb
    aa - bc
    ac - bd
    ad -
    af -


    I need to imitate the possibility of
    A. Sort column B (so empty space is on the bottom)
    B. Sort column A where there is data in column B (B will become unsorted, but that is okay)

    But even when doing that, Column A becomes fully re-sorted instead of just the selected data.
    Last edited by Suamere; 08-22-2011 at 01:52 PM.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Sort Part of a List

    Select only the rows of cells you wish.

    I'm not sure what else to say. I copied your data, sorted as I described, and got your desired results.

  6. #6
    Registered User
    Join Date
    09-29-2006
    Posts
    15

    Re: Sort Part of a List

    I did not mention this is 2010, could be the difference. Maybe there is a checkbox that says to always select the entire active-range whether you ask it to or not.

    When I select B1-B7 and sort, the data moves to the top (alphabetically) and the bottom 2 are empty.
    Then I select A1-A5 (because they have data in col B) and sort those... but all 7 rows are sorted by column A.

    I don't think this is a 2010 issue. I have found that with a new table, even one with Freeze Frames, I can accomplish what I want using a "custom sort" instead of just clicking A-Z on my selection.

    However, on the same workbook, for some reason, I cannot sort just a few of my rows. ANY sorting I do automatically does the entire table. Yes, I CAN select the column to sort by, but no matter how I do the selection, it will apply it to the whole table.
    Last edited by Suamere; 08-22-2011 at 02:59 PM.

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

    Re: Sort Part of a List

    So now it's time to post an example workbook...



  8. #8
    Registered User
    Join Date
    09-29-2006
    Posts
    15

    Re: Sort Part of a List

    This was certainly important to take care of, and I'd love to solve it. Also, thanks for the help. But I just copy pasted the data and re-formatted it seemingly EXACTLY the same, and the issue didn't follow the worksheet. Same book and everything.

    To sum up, when trying to sort any part of the table, the entire table would auto-select and any sorting done to any column would apply to the whole table. To make my sort work, I had to sort by column B, then sort part of the results by column A. Not sure what was locking it into auto-expand to the whole area, but a new sheet fixed that. If anybody has an idea it would be great for the future, but for now a new sheet works.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Sort Part of a List

    All's well that ends well.

+ 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