Transpose Vertical Data Horizontally with Date break

calinini

New Member
Joined
Jul 13, 2015
Messages
9
Hello!

I have a set of data with the dates and times in a column. However I need the dates to remain vertical and the times to be horizontal.

Example:
NAMEIDDATETIME
ABC1234565/8/20206:00A
ABC1234565/8/202011:00A
ABC1234565/8/202012:00P
ABC1234565/8/20204:00P
ABC1234565/9/20205:58A
ABC1234565/9/20204:00P
BCD2345675/8/202010:00A
BCD2345675/8/20202:00P
BCD2345675/8/20203:00P
BCD2345675/8/20208:00P


The desired output would be:

NAMEIDDATETIME1TIME2TIME3TIME4TIME5
ABC1234565/8/20206:00A11:00A12:00P4:00P
ABC1234565/9/20205:58A4:00P
BCD2345675/8/202010:00A2:00P3:00P8:00P


While I could transpose all manually, I have over 35000 rows of data.

Some days, a person might have 2 punches, on another 8. This is why a simply transpose doesn't work, nor a pivot table.

HELP PLEASE. TIA.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Will this presentation work for you. If yes, advise and I will share solution.

Book4
ABCDEFGHI
1NAMECustom.IDCustom.DATE123456
2ABC1234565/8/20206:00A11:00A12:00P4:00P
3ABC1234565/9/20205:58A4:00P
4BCD2345675/8/202010:00A2:00P3:00P8:00P
Sheet2
 
Upvote 0
Will this presentation work for you. If yes, advise and I will share solution.

Book4
ABCDEFGHI
1NAMECustom.IDCustom.DATE123456
2ABC1234565/8/20206:00A11:00A12:00P4:00P
3ABC1234565/9/20205:58A4:00P
4BCD2345675/8/202010:00A2:00P3:00P8:00P
Sheet2

Possibly. Looking at this though would every date have to be in a different col? I see that 5/9/2020 starts on COLH. I have approx 400 Names and the date span is 5/8/2020 - 6/4/2020. Ultimately, yes I could filter and delete cells and shift over if need be.
 
Upvote 0
With Power Query, here is the Mcode for the steps taken.

Rich (BB code):
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"NAME", type text}, {"ID", Int64.Type}, {"DATE", type date}, {"TIME", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"NAME"}, {{"Data", each _, type table [NAME=text, ID=number, DATE=date, TIME=text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Data], "Index", 1, 1)),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"ID", "DATE", "TIME", "Index"}, {"Custom.ID", "Custom.DATE", "Custom.TIME", "Custom.Index"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Data"}),
    #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Removed Columns", {{"Custom.Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Removed Columns", {{"Custom.Index", type text}}, "en-US")[Custom.Index]), "Custom.Index", "Custom.TIME")
in
    #"Pivoted Column"
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

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