I have a spreadsheet managing a list of groups in time slots. Imagine the below are cells:
0830-0845, Bob Hoskins, Jack Table, Phil Cup
0845-0900, Bob Hoskins, J
Assuming your data starts in A2. Parse your input as Fixed Width to isolate the -
and the first ,
. Select Text for the first and third columns. Format the sheet as General. In D2 put:
=IF(E1<>E2,"S",IF(E2<>E3,"F",""))
and copy down to suit.
Copy ColumnD, Paste Special, Values over the top and delete rows with blanks in Column D. In B2 put:
=IF(AND(D2="S",D3="F"),A2&"-"&C3,IF(D2="S",A2&"-"&C2,""))
and copy down to suit.
Copy ColumnB, Paste Special, Values over the top and delete rows with blanks in Column B. In A2 put =B2&", "&E2
and copy down to suit. Copy ColumnA, Paste Special, Values over the top.
Delete all but ColumnA.
Partial solution that is fairly easy to maintain using Pivot tables:
Get start time column:
Add new column with formula: =VALUE(MID(RC[-4],1,4))
Where RC[-4] is your original time range.
Get end time column:
Add new column with formula: =VALUE(MID(RC[-5],6,10))
Where RC[-5] is your original time range.
Concatenated names column:
=CONCATENATE(RC[-5],RC[-4],RC[-3])
Where RC[-5], RC[-4], RC[-3] are the cells with the name values.
This is for grouping in Pivot Table.
You should get something like this:
Note headers are important!
Insert a pivot table with your new extended table into a new worksheet:
Set row labels to name concatenation column.
Add start time column as value, with value field setting as min
Add end time column as value, with value field setting as max
Set the number format of min of start and max of end as '0000' so it displays time correctly
In terms of maintainability:
Simplifications/Assumptions:
With excel, my advice is always to leverage existing tools as much as possible rather than use overly complicated cell formulas which can be hard to debug and possibly less efficient.
Let me know if this output is useful enough otherwise I'll see what else can be done.
I performed these steps as per Excel 2010, but this should work for other versions as well (with some minor changes).
Steps:
a) Select all data cells b) Goto Data --> Data Tools --> Remove Duplicates c) Seems that there are 4 columns in your data file, so in the popup you'll see 4 columns (say Column A, Column B, Column C, and Column D). Check all columns except Column A (i.e. where your timestamps exist). Press OK.
Note: In this solution, the first timestamp (and not the range) will show up for each unique line e.g.
0830-0845, Bob Hoskins, Jack Table, Phil Cup
0945-1000, Jane Dunnit, Henry Badass
1030-1045, Terry Turbo
1100-1115, Simon Car, Maggie Blah, Jack Paper