Crosstab, Transform, or Pivot? I'm lost...

OVH

New Member
Joined
Nov 27, 2012
Messages
25
Trying to figure out the best way to turn my rows into columns, while maintaining the values and headers. Looks like a reverse crosstab query or something. I'm an amateur btw...

I have about 35 columns that I want to stay the same (keep as columns), then about 50 column that have months (Oct_2016, Nov_2016, etc.) across the top where I want the months as a single column with the value next to it.

Example below

Current table:
IndustryCustomerOctoberNovemberDecemberJanuaryFebruaryMarchAprilMay
FinanceCust111111111
TechCust211111111
ConsumerCust311111111

<tbody>
</tbody>


Future Table:
IndustryCustomerDateValue
FinanceCust1October1
TechCust2October1
ConsumerCust3October1
FinanceCust1November1
TechCust2November1
ConsumerCust3November1
FinanceCust1December1
TechCust2December1
ConsumerCust3December1
FinanceCust1January1
TechCust2January1
ConsumerCust3January1
FinanceCust1February1
TechCust2February1
ConsumerCust3February1
FinanceCust1March1
TechCust2March1
ConsumerCust3March1
FinanceCust1April1
TechCust2April1
ConsumerCust3April1
FinanceCust1May1
TechCust2May1
ConsumerCust3May1

<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>

Any idea how I can do this MS Access? Ideally using the designer type of UI vs. SQL/VBA, but I'm open to anything that works...
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
you can try PowerQuery aka Get&Transform

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Industry", type text}, {"Customer", type text}, {"October", Int64.Type}, {"November", Int64.Type}, {"December", Int64.Type}, {"January", Int64.Type}, {"February", Int64.Type}, {"March", Int64.Type}, {"April", Int64.Type}, {"May", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Industry", "Customer"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"[/SIZE]

IndustryCustomerOctoberNovemberDecemberJanuaryFebruaryMarchAprilMayIndustryCustomerAttributeValue
FinanceCust1
1​
1​
1​
1​
1​
1​
1​
1​
FinanceCust1October
1​
TechCust2
1​
1​
1​
1​
1​
1​
1​
1​
FinanceCust1November
1​
ConsumerCust3
1​
1​
1​
1​
1​
1​
1​
1​
FinanceCust1December
1​
FinanceCust1January
1​
FinanceCust1February
1​
FinanceCust1March
1​
FinanceCust1April
1​
FinanceCust1May
1​
TechCust2October
1​
TechCust2November
1​
TechCust2December
1​
TechCust2January
1​
TechCust2February
1​
TechCust2March
1​
TechCust2April
1​
TechCust2May
1​
ConsumerCust3October
1​
ConsumerCust3November
1​
ConsumerCust3December
1​
ConsumerCust3January
1​
ConsumerCust3February
1​
ConsumerCust3March
1​
ConsumerCust3April
1​
ConsumerCust3May
1​
 
Upvote 0
A crosstab query should work for Access, also. Did you try that?
 
Upvote 0

Forum statistics

Threads
1,214,615
Messages
6,120,538
Members
448,970
Latest member
kennimack

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