group 2 columns together before sorting

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
458
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Can someone help me figure out the code for grouping 2 columns together before sorting by columns?

example data:
where columns A & B need to be grouped together, C & D together, E & F together, etc...
When the sort is done it is only to sort by the name column (first column in each group of 2... A = Steve, C = John, E = Zeke... etc)

so before sort:

A B C D E F G H
1 Steve6/9/2010John1/1/2017Zeke5/5/2013Adam2/5/2008
212/17/20148/5/20131/18/20128/4/2015
39/1/201010/2/201611/19/20145/27/2011

<tbody>
</tbody>



and after sorting and with grouping every 2 columns together:

A B C D E F G H
1 Adam2/5/2008John1/1/2017Steve6/9/2010Zeke5/5/2013
28/4/20158/5/201312/17/20141/18/2012
35/27/201110/2/20169/1/201011/19/2014

<tbody>
</tbody>
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
The objective is not clear. Would it not be simpler to list the dates beneath the applicable names? It would definitely simplify the sorting.
 
Upvote 0
The objective is not clear. Would it not be simpler to list the dates beneath the applicable names? It would definitely simplify the sorting.

Ok... I was trying to keep my question simple so I didnt needlessly complicate what I was after... but i guess some context to what I am actually attempting to do would clarify the objective;

Here is my spreadsheet with just the NAME column showing;
i3wdv7.jpg


Here it is with the adjacent DATE column showing a date to signify if training took place (by an X) and if so, the corresponding date that the training took place.
2v7v6t4.jpg



Currently, every time I have to add a new name to this worksheet, I have to copy an existing name/date column, paste it onto the end somewhere, then correct it with the new name and "X" 's and dates, and then cut-and-insert the that new person into the appropriate spot (alphabetically.)

Before (a year or so ago) I had it working so that this sort could be executed via a macro, but i lost all conditional formatting when I did it (so I abandoned that idea.)

Now, I am re-visiting this idea as I am going to have a macro that (1) clears the conditional formatting, (2) groups each name column and its corresponding date column together, (3) sorts all of those grouped columns alphabetically by the name, and then (4) copies the formatting and conditional formatting from 2 columns that were previously not cleared in step 1, and pastes that formatting to all the name/date collumns that were just sorted.
icon14.png

(at least that is my plan
icon6.png
lol )

If anyone has a better, simpler idea... I am all ears...
Please and Thank you for any/all help here.
 
Upvote 0
I think I will just drop off this thread. I could probably work something up, but it would take quite a while because I do not readily have the code in mind that would do what you want, and that means resarch, trial and error until I get it. That is more time than I like to spend on a thread. Sorry.
Regards, JLG
 
Upvote 0

Forum statistics

Threads
1,216,071
Messages
6,128,623
Members
449,460
Latest member
jgharbawi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top