+ Reply to Thread
Results 1 to 13 of 13

Limit Sorting to Multiple Sets of Rows in Same Column

  1. #1
    Registered User
    Join Date
    12-01-2015
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    25

    Limit Sorting to Multiple Sets of Rows in Same Column

    Hi, I've try to search for this every where but got no luck. I'm trying to create some materials for studying. I'm looking for any solutions (macro or add-ins, even paid) that could do a multiple sorting but limit the sorting within a range.

    For example, in the attached spreadsheet, I would like to be able to sort automatically the whole Column C, but the sorting are restricted to each category. That is, "aa,bb,cc,dd" will only be randomized within Category 1 box, c2:c5. And, "kk,ll,mm,nn"would only be randomized within c6:c9, etc. The number of rows will be static at 4 cells/rows per category.

    Is this even possible? I can do them manually but I will have hundreds more. I tried to create macro but the macro only sort what I selected. This means I have to record everything first then reuse the macro next time I need to randomize Column C.

    -I'm thinking maybe there's a macro that can sort every 4 rows (column C & D for randomization), until the end of the column (no more text).

    -I think my situation might be some what similar to this case: http://www.excelforum.com/excel-prog...gle-sheet.html

    However, I have no idea what any of those code really means.

    Thank you for your generous help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    Is it always 4 rows.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    Hi all. Paste this in a standard module. Starting on row 2, it sorts columns C:D of the active sheet in 4-row sections:
    Please Login or Register  to view this content.
    Last edited by leelnich; 10-13-2017 at 04:41 AM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  4. #4
    Registered User
    Join Date
    12-01-2015
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    25

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    Quote Originally Posted by kvsrinivasamurthy View Post
    Is it always 4 rows.
    Hi, kvsrinivasamurth. Yes, it is.

    Quote Originally Posted by leelnich View Post
    Hi all. Paste this in a standard module. Starting on row 2, it sorts columns C:D of the active sheet in 4-row sections:
    Please Login or Register  to view this content.
    hi, neelnich. Wow, that works magically!

    Hope you don't mind, but on the same sheet, is there quick/automated way to copy/paste/drag the formula to be incremental every nth row?

    For example:

    B2: =Sheet1!B3&CHAR(10)
    B6: =Sheet1!B4&CHAR(10)
    B10 = Sheet1!B5&CHAR(10)

    on an don...?

    Thanks, again!

  5. #5
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    Paste this UGLY formula in B2 and copy down:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-01-2015
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    25

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    wow, you're amazing. Thanks. I'd buy your a beer if there was a donate button.

    Thanks so much!

  7. #7
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    You're most welcome, thank you for the rep!

  8. #8
    Registered User
    Join Date
    12-01-2015
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    25

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    Hi, leelnich,

    I'm using your code and came up with another similar to the formula you gave me.

    It is possible to do offset for column?

    For example: I want to fill:

    Data!E3
    Data!F3
    Data!G3
    Data!H3
    Data!E4
    Data!F4
    Data!G4
    Data!H4


    And that it would fill down the same pattern every 4 rows?

    Thanks, again.

  9. #9
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    Sorry, not sure what you want. Could you upload a workbook showing:
    1) where the data is
    2) where the results go (simulate them, please)

    Thanks! - Lee

  10. #10
    Registered User
    Join Date
    12-01-2015
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    25

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    Oh, sorry.

    I attached the spreadssheet. So pretty much, I just want to be able to fill the rest of the categories on Sheet1 to match the pattern:
    A#
    B#
    C#
    D#
    A#
    B#
    C#
    D#

    Should I make a new thread or this is ok?

    Thanks, again.
    Attached Files Attached Files

  11. #11
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    Paste this in B2 and copy down:
    Please Login or Register  to view this content.
    Last edited by leelnich; 10-18-2017 at 08:00 PM.

  12. #12
    Registered User
    Join Date
    12-01-2015
    Location
    U.S.
    MS-Off Ver
    2016
    Posts
    25

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    Ah, I was trying to do with TRUNC(COLUMNS). Thanks, again!

  13. #13
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Limit Sorting to Multiple Sets of Rows in Same Column

    You're welcome! If complete, please mark your thread as SOLVED (Thread Tools up top). Thanks -Lee

+ 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 sorting multiple sets of columns
    By Roger1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-12-2015, 06:46 PM
  2. Replies: 11
    Last Post: 02-18-2015, 12:21 PM
  3. [SOLVED] SORTING by COLUMN A (NAME) COL B has multiple rows
    By mr_sock in forum Excel General
    Replies: 8
    Last Post: 02-12-2014, 09:57 AM
  4. Conditional Formatting Rows, and Matching and Sorting Two Sets of Data
    By Alan L 185 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-07-2013, 08:16 PM
  5. Sorting sets of rows based on cell
    By mpkavanagh in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-17-2011, 11:35 AM
  6. [SOLVED] How do I limit sorting a column to the column?
    By Pat in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-09-2006, 12:10 PM
  7. [SOLVED] Pivot Table, Limit 255 rows, Invert rows and column
    By xav in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-29-2005, 10: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