+ Reply to Thread
Results 1 to 14 of 14

Inserting Breaks In Two Sorted Columns

  1. #1
    Registered User
    Join Date
    05-19-2009
    Location
    California
    MS-Off Ver
    Excel 2013-16
    Posts
    55

    Inserting Breaks In Two Sorted Columns

    I have been struggling to figure this out for several days now and i don't really know where to go from here.

    I have 2 columns and i need to break them up at certain points.

    The attached excel file should hopefully be clear enough to show what i mean.
    The first tab is how the data starts the second tab is how i want it to look.

    To clarify i need to break it after each change in the first column. ie from 1 to 2.

    Furthermore, i need to break the "sub groups" the second column up after 15, and 30. I will never have a number larger than 32 in the second column.

    I think the excel file will clear up what i mean.

    Any help with this would be greatly appreciate.

    Thanks!
    Attached Files Attached Files
    Last edited by justforthis1; 07-21-2009 at 05:15 PM. Reason: solved

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Inserting Breaks In Two Sorted Columns

    Hi Justforthis1,

    Try this on a test worksheet (it seems to work on the one you uploaded):
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-19-2009
    Location
    California
    MS-Off Ver
    Excel 2013-16
    Posts
    55

    Re: Inserting Breaks In Two Sorted Columns

    It took me a few minutes to figure out how to modify it for my application...

    But, it seems to work PERFECTLY!

    Thanks so much.

  4. #4
    Registered User
    Join Date
    05-19-2009
    Location
    California
    MS-Off Ver
    Excel 2013-16
    Posts
    55

    re: Inserting Breaks In Two Sorted Columns

    Alright... well much to my dismay i realized after putting all of this together that i had to do another data separation as well...

    The current solution works perfectly! exactly what i need it to do.

    But...

    i ALSO need to sort the same data by putting line breaks after every 4th item in the 1st column =/

    ie. 4,8,12,16...,80,84

    something of that nature... any ideas?


    this doesn't need to be tied into the previous part necessarily. It would actually work better as a separate solution...just using the same numbers.
    Last edited by justforthis1; 07-14-2009 at 02:51 PM. Reason: more info...

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    re: Inserting Breaks In Two Sorted Columns

    So regardless of the number in column 1 or 2, just add a blank cell after every fourth row? Or do you still need to add a blank between different numbers in column 1, and after 15/30 in column 2? Perhaps an example before/after would help. Shouldn't be too difficult to code.

  6. #6
    Registered User
    Join Date
    05-19-2009
    Location
    California
    MS-Off Ver
    Excel 2013-16
    Posts
    55

    re: Inserting Breaks In Two Sorted Columns

    sure... just a moment.

  7. #7
    Registered User
    Join Date
    05-19-2009
    Location
    California
    MS-Off Ver
    Excel 2013-16
    Posts
    55

    re: Inserting Breaks In Two Sorted Columns

    here is the updated formatting... hope that helps.
    Attached Files Attached Files

  8. #8
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    re: Inserting Breaks In Two Sorted Columns

    Just to be clear..

    Will your data always be in numerical order using 1,2,3,4,5,6,etc.. or should the code just look for every fourth change in column A and add a blank row?

  9. #9
    Registered User
    Join Date
    05-19-2009
    Location
    California
    MS-Off Ver
    Excel 2013-16
    Posts
    55

    Re: Inserting Breaks In Two Sorted Columns

    These 2 columns that i am using to sort should always be in descending numerical order.

    1
    2
    3
    4
    5
    etc

    Thanks for your help

  10. #10
    Registered User
    Join Date
    05-19-2009
    Location
    California
    MS-Off Ver
    Excel 2013-16
    Posts
    55

    Re: Inserting Breaks In Two Sorted Columns

    Anyone have further ideas on this?

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Breaks In Two Sorted Columns

    If I understand your issue (iffy at best), this may work:
    Please Login or Register  to view this content.
    This will go in a general module. Hope it helps.

    J

  12. #12
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Inserting Breaks In Two Sorted Columns

    Hi Just, sorry about not getting back to you sooner. An alternative to J's code is:
    Please Login or Register  to view this content.
    Result is the same for either bit of code.

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Inserting Breaks In Two Sorted Columns

    Neat Paul...wish I could write code like that.

    J

  14. #14
    Registered User
    Join Date
    05-19-2009
    Location
    California
    MS-Off Ver
    Excel 2013-16
    Posts
    55

    Re: Inserting Breaks In Two Sorted Columns

    wow thanks guys. that helps me immensely

    i will run the code through some tests but i expect it does exactly what i need.

+ 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