Forum

Rows with multiple
 
Notifications
Clear all

Rows with multiple

4 Posts
4 Users
0 Reactions
89 Views
(@afl)
Posts: 1
New Member
Topic starter
 

Hi there, I have a table of data from a query containing listings of one entry for each issue date of a document. I want to merge this into one entry of each document containing every issue dates in the following columns.

From this:

Document  ID Date
34304          23.11.2011
34304          24.03.2012
34305          23.11.2011
34305          24.03.2012
34305          26.03.2017
34306          23.11.2011

 

Into this:

Document  ID   Date-1        Date-2       Date-3       ...    Date-n
34304                23.11.2011   24.03.2012
34305                23.11.2011   24.03.2012  26.03.2017
34306                23.11.2011   

Is there an easy way doing this in Power Query, alternatively a VBA code.

In advance thanx.           

 
Posted : 21/11/2017 4:25 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Aslak,

I would just use a PivotTable to do this. In the file attached there is the PivotTable solution and the Power Query solution. It's up to you which one you use.

Mynda

 
Posted : 21/11/2017 9:20 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi

Just a slight variation to Mynda's PivotTable solution.

This will ensure that all dates begin in the 1st column and so on without any blanks in between.

Hope this helps.

Sunny

 
Posted : 22/11/2017 12:40 am
(@shaowu459)
Posts: 44
Eminent Member
 

Please refer to attached file with a helper column.

 
Posted : 22/11/2017 2:04 am
Share: