SOLVED

Data Transformation Help

Copper Contributor

Hi,

 

I have a collection of data that is ordered like this (see below). We have a lot of our older sheets setup this way and would like to develop a VBA script to help us make this light work. 


Most of the tables are like this:

MemberMember IDBuyer IDJanFebDec2019JanFebDec2020
Reza4323274329
Reza4211131113
Shiya33233856314
Hassan103234927413

 

... and we would like the above data into this format:

 

NameMember IDDateYearMonth  Volume Buyer ID

 

Question is ... would you attempt this with formulas (index, match, sumifs) or is this a job for some VBA macros. Just need some advice which way to go to look up solutions or if there are ready made solutions out there we could adapt, great!

Thanks

 

Update: Looks like Power Query does help in exactly this situation: https://youtu.be/JMrfbv2h7p8

 

Join 400,000+ professionals in our courses here 👉 https://link.xelplus.com/yt-d-all-courses It sounds simple to just switch columns to rows in Microsoft Excel - basically transpose horizontal data to vertical. BUT you can't always use a simple transpose (neither the transpose feature nor the ...
3 Replies

@twwareza 

Looks like job for Power Query if you consider such option. 

As for the task itself it's not clear where are in first table Location, Product, Buyer Name. Better if you provide small sample file with first table as in your post and second one as it shall be, using data in first table.

Thanks.
Sorry they were mockups. I appended a sample file with the main headings now matching.

I was not sure how to tackle the Jan, Feb columns, as these now need to be transformed into rows with the same member/etc.

PQ seems like the way to go though.

Thanks

best response confirmed by twwareza (Copper Contributor)
Solution

@twwareza 

Thank you. It's still not clear from here Date shall be taken, preliminary that's like

- name source data range, e.g. as Source and query it (as variant work with tables)

- use first rows as headers and unpivot other than first 3 columns

- duplicate column with month/years, convert to number and replace errors on nulls. Duplicate again

- fill years, filter not null in last column, extract first 3 characters from months

- cosmetic and return back to Excel table.

image.png

1 best response

Accepted Solutions
best response confirmed by twwareza (Copper Contributor)
Solution

@twwareza 

Thank you. It's still not clear from here Date shall be taken, preliminary that's like

- name source data range, e.g. as Source and query it (as variant work with tables)

- use first rows as headers and unpivot other than first 3 columns

- duplicate column with month/years, convert to number and replace errors on nulls. Duplicate again

- fill years, filter not null in last column, extract first 3 characters from months

- cosmetic and return back to Excel table.

image.png

View solution in original post