Transform data

esbencito

New Member
Joined
May 22, 2017
Messages
16
Hi all,

I need to transform/ re-arrange data in Access. Below table illustrates the data that I currently have:

[TABLE="class: grid, width: 700"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Year[/TD]
[TD]FY18[/TD]
[TD]FY18[/TD]
[TD]FY18[/TD]
[TD]FY18[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Month[/TD]
[TD]MAR[/TD]
[TD]MAR[/TD]
[TD]FEB[/TD]
[TD]FEB[/TD]
[/TR]
[TR]
[TD]Country[/TD]
[TD]Channel[/TD]
[TD]Brand[/TD]
[TD]Item Number[/TD]
[TD]SLS UNT[/TD]
[TD]SLS CST[/TD]
[TD]SLS UNT[/TD]
[TD]SLS CST[/TD]
[/TR]
[TR]
[TD]China[/TD]
[TD]RLS[/TD]
[TD]MSW[/TD]
[TD]10004[/TD]
[TD]34[/TD]
[TD]$87.00[/TD]
[TD]56[/TD]
[TD]$80.00[/TD]
[/TR]
[TR]
[TD]Vietnam[/TD]
[TD]RLE[/TD]
[TD]MSW[/TD]
[TD]10006[/TD]
[TD]32[/TD]
[TD]$76.00[/TD]
[TD]45[/TD]
[TD]$92.00[/TD]
[/TR]
[TR]
[TD]China[/TD]
[TD]RLC[/TD]
[TD]WSW[/TD]
[TD]10009[/TD]
[TD]29[/TD]
[TD]$97.00[/TD]
[TD]47[/TD]
[TD]$71.00[/TD]
[/TR]
[TR]
[TD]Thailand[/TD]
[TD]RLS[/TD]
[TD]WSW[/TD]
[TD]10008[/TD]
[TD]17[/TD]
[TD]$65.00[/TD]
[TD]50[/TD]
[TD]$83.00[/TD]
[/TR]
[TR]
[TD]Singapore[/TD]
[TD]RLC[/TD]
[TD]CSW[/TD]
[TD]10003[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]38[/TD]
[TD]$91.00[/TD]
[/TR]
</tbody>[/TABLE]

In order to pivot it, I want it to look like this:

[TABLE="class: grid, width: 700"]
<tbody>[TR]
[TD]Year[/TD]
[TD]Month[/TD]
[TD]Country[/TD]
[TD]Channel[/TD]
[TD]Brand[/TD]
[TD]Item Number[/TD]
[TD]SLS UNT[/TD]
[TD]SLS CST[/TD]
[/TR]
[TR]
[TD]FY18[/TD]
[TD]MAR[/TD]
[TD]China[/TD]
[TD]RLS[/TD]
[TD]MSW[/TD]
[TD]10004[/TD]
[TD]34[/TD]
[TD]$87.00[/TD]
[/TR]
[TR]
[TD]FY18[/TD]
[TD]FEB[/TD]
[TD]China[/TD]
[TD]RLS[/TD]
[TD]MSW[/TD]
[TD]10004[/TD]
[TD]56[/TD]
[TD]$80.00[/TD]
[/TR]
[TR]
[TD]FY18[/TD]
[TD]MAR[/TD]
[TD]Vietnam[/TD]
[TD]RLE[/TD]
[TD]MSW[/TD]
[TD]10006[/TD]
[TD]32[/TD]
[TD]$76.00[/TD]
[/TR]
[TR]
[TD]FY18[/TD]
[TD]FEB[/TD]
[TD]Vietnam[/TD]
[TD]RLE[/TD]
[TD]MSW[/TD]
[TD]10006[/TD]
[TD]45[/TD]
[TD]$92.00[/TD]
[/TR]
[TR]
[TD]FY18[/TD]
[TD]MAR[/TD]
[TD]China[/TD]
[TD]RLC[/TD]
[TD]WSW[/TD]
[TD]10009[/TD]
[TD]29[/TD]
[TD]$97.00[/TD]
[/TR]
[TR]
[TD]FY18[/TD]
[TD]FEB[/TD]
[TD]China[/TD]
[TD]RLC[/TD]
[TD]WSW[/TD]
[TD]10009[/TD]
[TD]47[/TD]
[TD]$71.00[/TD]
[/TR]
[TR]
[TD]FY18[/TD]
[TD]MAR[/TD]
[TD]Thailand[/TD]
[TD]RLS[/TD]
[TD]WSW[/TD]
[TD]10008[/TD]
[TD]17[/TD]
[TD]$65.00[/TD]
[/TR]
[TR]
[TD]FY18[/TD]
[TD]FEB[/TD]
[TD]Thailand[/TD]
[TD]RLS[/TD]
[TD]WSW[/TD]
[TD]10008[/TD]
[TD]50[/TD]
[TD]$83.00[/TD]
[/TR]
[TR]
[TD]FY18[/TD]
[TD]FEB[/TD]
[TD]Singapore[/TD]
[TD]RLC[/TD]
[TD]CSW[/TD]
[TD]10003[/TD]
[TD]38[/TD]
[TD]$91.00[/TD]
[/TR]
</tbody>[/TABLE]

Is this feasible somehow?
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi,

Your first table is not a valid Access table (it has empty cells in the top left corner and seemingly two column header rows which is not a valid table structure. Are you saying you want to import the data into Access from (possibly) Excel?

Also, the data is already pivoted in table 1 so it isn't clear why you would need to do this to pivot the data. Are you sure you need to do this in Access?
 
Upvote 0
You're right, I get the raw data in table 1 in an Excel file (it is not a pivot though). I have not yet tried to import it into Access, as I first want to figure out what's the best approach to transform the data in order to create a meaningful pivot table (which should then look something like table 1).

I currently cannot create a pivot table from table 1 unless I combine FY18 & MAR & SLS UNT into one column header, but then I wouldn't be able to filter by Year or Month anymore. So I need to somehow transform the data into table 2... :rolleyes:
 
Upvote 0
This super useful!! Thanks for sharing! Unfortunately, it won't work in my case, as the data exceeds 1,000,000 rows once it is transformed as seen in table 2, so it would have to be done in Access I guess :rolleyes:
 
Upvote 0
I think Excel could handle 1,000,000 rows, most likely. It doesn't exceed the row limit, in any case.
 
Upvote 0

Forum statistics

Threads
1,223,355
Messages
6,171,608
Members
452,411
Latest member
sprichwort

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