I am working with a huge MS Excel 2010 spreadsheet to track projects and tasks within a project. Each task may have a different delivery date. I would like to group the data by project then sort the projects by earliest delivery date of any task within that project.
So a simple sample of the data looks as follows:
COLUMN A COLUMN B COLUMN C
7/28/2011 Deploy Project Task a
7/14/2011 AD Project Task b
7/30/2011 AD Project Task a
7/18/2011 Deploy Project Task d
7/20/2011 Condolidation Project Task f
7/28/2011 Deploy Project Task c
etc etc
So, what I am trying to acomplish is how to Group the data in COLUMN B (Project) then sort the Project Groups and each task within that Group by COLUMN A (Delivery date of task) while respecting the groupings. In other words the end result would look something like this:
7/14/2011 AD Project Task b
7/30/2011 AD Project Task a
7/18/2011 Deploy Project Task d
7/28/2011 Deploy Project Task a
7/28/2011 Deploy Project Task c
7/20/2011 Condolidation Project Task f
Any advice on how to easily acomplish this?
How about a custom sort...
First by column B, then A, and then C
HTH
Regards, Jeff
If you like the answer(s) provided, why not add some reputation by clicking the * below
Please use [ Code ] tags when posting [ /Code ]
Please view/read the Forum rules --- How to mark a thread as solved
That wouldn't work. It would sort projects by name A to Z or Z to A and then sort the tasks in the projects by delivery but it would not for example bring a project to the top of the list based on delivery date of one of it's tasks. Again I need to group each task row by Project Name THEN sort by earliest task delivery date while respecting the groupings.
In the example above your solution would bring the Consolidation Project ahead of the Deploy Project because it starts with C even though the Deploy Project has a task due earlier
The only way I can see this as manageable is probably with a macro (VBA). Are you ok with a VBA solution?
To be crystal clear, you should upload a workbook with a BEFORE and an AFTER sheet showing fully what you want to accomplish. Your small dataset above "seems" to present clearly, but think about it now. If we're going to write a macro to reformat your BEFORE dataset into your AFTER dataset, think about it fully now and make sure all the issues that need to be overcome are represented in that data. Expand as needed, then mockup that AFTER sheet.
Click GO ADVANCED and use the paperclip icon to post up your workbook.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Hi bool and welcome to the forum,
I think Jeff may have been right but made a sample file to check his answer. Find attached what I think you are asking. If youi sort by date and then by Project you get the following.
Let us know if we don't undersand the question.
One test is worth a thousand opinions.
Click the * below to say thanks.
Hi MarvinP,
Not what I am looking for. In your file, how can Project 1 with its earliest task due on 9/12/11 be sorted first than Project 9 with its earliest task due on 7/211 ?
The desired outcome in your speadsheet example would be:
7/2/11 Project 9 Task 49
8/18/11 Project 9 Task 9
9/24/11 Project 9 Task 39
9/28/11 Project 9 Task 29
11/19/11 Project 9 Task 19
7/4/11 Project 6 Task 36
8/13/11 Project 6 Task 16
8/29/11 Project 6 Task 6
10/17/11 Project 6 Task 46
12/12/11 Project 6 Task 26
7/9/11 Project 7 Task 37
9/24/11 Project 7 Task 27
11/24/11 Project 7 Task 47
12/31/11 Project 7 Task 7
1/1/12 Project 7 Task 17
etc, etc
Notice that I am looking to sort the projects by earliest task due date
Hello JBeaucaire,
I am up for any method that will provide an easy solution.
I am attaching MarvinP's spreadsheet with two tabs that represent the sample data and the desired result after grouping and sorting.
I am not familiar with macros or VBA
Thank you!
Try this:
Option Explicit Sub SortSpecial() Dim LR As Long LR = Range("A" & Rows.Count).End(xlUp).Row With Range("A1:C" & LR) .Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortTextAsNumbers .Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End With With Range("A2:A" & LR) .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:= _ "=COUNTIF($B$1:$B1,$B1)=1" With .FormatConditions(1).Font .Bold = True .Italic = False End With End With End Sub
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Ok bool,
See the attached. I've created a pivot table of the data where the rows are Project first. Then the summation is the MIN of the date for each Project. Then I added Task in Row area.
To test this - Change any date or field in the Data (Cols A to C) and see the Pivot Refresh with an Event Macro behind sheet 1.
This was a very tough problem but I think this solves it for you.
One test is worth a thousand opinions.
Click the * below to say thanks.
in marvins example to get the result you show
sort the lot by column a
in d2 put this array entered formula
=MIN(IF($B$2:$B$51=B2,$A$2:$A$51,""))&B2
confirmed with ctrl+ shift+enter
drag down to last entry in col a
now sort by column d
"Unless otherwise stated all my comments are directed at OP"
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
Simple non-code method:
1. Sort the data by Project.
2. Data - subtotals, at change in Project use Min of Delivery date.
3. Collapse data so only subtotals visible.
4. Select and sort by Delivery date
5. Remove subtotals.
![]()
@romperstomper -
I've never worked with the Subtotal dialog. It looks like a winner for this problem. Is there a way to do this using the Subtotal Function in a helper column?
Finding the Subtotal Dialog was like finding another blade on my swiss army knife of tools. Thanks for showing it to me/us.
Marv
One test is worth a thousand opinions.
Click the * below to say thanks.
Not easily no as you would have to work out what ranges to apply it to (in which case you might as well use Min)
Thanks to Everyone for the solutions. I set to try all three solutions from simplest to more complex: Sub-totals, Pivot Table, VBA Script
I give romperstomper the lead as his solution was the simplest (1-2 mins to implement) and provides the desired results. Thanks romperstomper!
Glad to help.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks