How can I reduce multple dated rows into just the start and end dates of those particular values?

mk000

Board Regular
Joined
Dec 10, 2004
Messages
234
Say I have rows of people and their school, it can change over time, so I have many rows for each person, each with a start and end date...

ID Start Date End Date School
Mike 1/1/10 5/1/10 OSU
Mike 5/2/10 12/31/9999 PSU

Tom 1/1/10 4/1/10 OSU
Tom 4/2/10 6/30/10 OSU
Tom 7/1/10 5/1/10 OSU
Tom 5/2/10 12/31/9999 PSU


Bob 1/1/10 4/1/10 OSU
Bob 4/2/10 6/30/10 OSU
Bob 7/1/10 9/6/10 OSU
Bob 9/7/10 12/31/9999 OSU

What's the best way to turn multiple rows of data into just the start and end dates for the school and name combination?

So I want in the end...

Mike 1/1/10 5/1/10 OSU
Mike 5/2/10 12/31/9999 PSU
Tom 1/1/10 5/1/10 OSU
Tom 5/2/10 12/31/9999 PSU
Bob 1/1/10 12/31/9999 OSU
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Try this query. You will have to change the field names to match your field names and tables.

SELECT Table2.sName, Min(Table2.Begin) AS MinOfBegin, Max(Table2.End) AS MaxOfEnd, Table2.School
FROM Table2
GROUP BY Table2.sName, Table2.School;

Alan
 
Upvote 0
The only thing is this does not work if I have movement from one school to another and back to the first school...

So

Ted 1/1/2000 12/31/2000 PSU
Ted 1/1/2001 12/31/2001 OSU
Ted 1/1/2002 12/31/9999 PSU


If take the begin min and the end max of each person/school

It'd look like this
Ted 1/1/2000 12/31/9999 PSU < THIS IS WRONG
Ted 1/1/2001 12/31/2001 OSU
 
Upvote 0

Forum statistics

Threads
1,213,556
Messages
6,114,284
Members
448,562
Latest member
Flashbond

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