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:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Industry[/TD]
[TD]Customer[/TD]
[TD]October[/TD]
[TD]November[/TD]
[TD]December[/TD]
[TD]January[/TD]
[TD]February[/TD]
[TD]March[/TD]
[TD]April[/TD]
[TD]May[/TD]
[/TR]
[TR]
[TD]Finance[/TD]
[TD]Cust1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]Cust2[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Consumer[/TD]
[TD]Cust3[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]


Future Table:
[TABLE="class: grid, width: 256"]
<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Industry[/TD]
[TD="width: 64"]Customer[/TD]
[TD="width: 64"]Date[/TD]
[TD="width: 64"]Value[/TD]
[/TR]
[TR]
[TD]Finance[/TD]
[TD]Cust1[/TD]
[TD]October[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]Cust2[/TD]
[TD]October[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Consumer[/TD]
[TD]Cust3[/TD]
[TD]October[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Finance[/TD]
[TD]Cust1[/TD]
[TD]November[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]Cust2[/TD]
[TD]November[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Consumer[/TD]
[TD]Cust3[/TD]
[TD]November[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Finance[/TD]
[TD]Cust1[/TD]
[TD]December[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]Cust2[/TD]
[TD]December[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Consumer[/TD]
[TD]Cust3[/TD]
[TD]December[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Finance[/TD]
[TD]Cust1[/TD]
[TD]January[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]Cust2[/TD]
[TD]January[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Consumer[/TD]
[TD]Cust3[/TD]
[TD]January[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Finance[/TD]
[TD]Cust1[/TD]
[TD]February[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]Cust2[/TD]
[TD]February[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Consumer[/TD]
[TD]Cust3[/TD]
[TD]February[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Finance[/TD]
[TD]Cust1[/TD]
[TD]March[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]Cust2[/TD]
[TD]March[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Consumer[/TD]
[TD]Cust3[/TD]
[TD]March[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Finance[/TD]
[TD]Cust1[/TD]
[TD]April[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]Cust2[/TD]
[TD]April[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Consumer[/TD]
[TD]Cust3[/TD]
[TD]April[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Finance[/TD]
[TD]Cust1[/TD]
[TD]May[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]Cust2[/TD]
[TD]May[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Consumer[/TD]
[TD]Cust3[/TD]
[TD]May[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]

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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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]

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Industry[/td][td=bgcolor:#5B9BD5]Customer[/td][td=bgcolor:#5B9BD5]October[/td][td=bgcolor:#5B9BD5]November[/td][td=bgcolor:#5B9BD5]December[/td][td=bgcolor:#5B9BD5]January[/td][td=bgcolor:#5B9BD5]February[/td][td=bgcolor:#5B9BD5]March[/td][td=bgcolor:#5B9BD5]April[/td][td=bgcolor:#5B9BD5]May[/td][td][/td][td=bgcolor:#70AD47]Industry[/td][td=bgcolor:#70AD47]Customer[/td][td=bgcolor:#70AD47]Attribute[/td][td=bgcolor:#70AD47]Value[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Finance[/td][td=bgcolor:#DDEBF7]Cust1[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td][/td][td=bgcolor:#E2EFDA]Finance[/td][td=bgcolor:#E2EFDA]Cust1[/td][td=bgcolor:#E2EFDA]October[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Tech[/td][td]Cust2[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td][/td][td]Finance[/td][td]Cust1[/td][td]November[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Consumer[/td][td=bgcolor:#DDEBF7]Cust3[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
1​
[/td][td][/td][td=bgcolor:#E2EFDA]Finance[/td][td=bgcolor:#E2EFDA]Cust1[/td][td=bgcolor:#E2EFDA]December[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Finance[/td][td]Cust1[/td][td]January[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Finance[/td][td=bgcolor:#E2EFDA]Cust1[/td][td=bgcolor:#E2EFDA]February[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Finance[/td][td]Cust1[/td][td]March[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Finance[/td][td=bgcolor:#E2EFDA]Cust1[/td][td=bgcolor:#E2EFDA]April[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Finance[/td][td]Cust1[/td][td]May[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Tech[/td][td=bgcolor:#E2EFDA]Cust2[/td][td=bgcolor:#E2EFDA]October[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Tech[/td][td]Cust2[/td][td]November[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Tech[/td][td=bgcolor:#E2EFDA]Cust2[/td][td=bgcolor:#E2EFDA]December[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Tech[/td][td]Cust2[/td][td]January[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Tech[/td][td=bgcolor:#E2EFDA]Cust2[/td][td=bgcolor:#E2EFDA]February[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Tech[/td][td]Cust2[/td][td]March[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Tech[/td][td=bgcolor:#E2EFDA]Cust2[/td][td=bgcolor:#E2EFDA]April[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Tech[/td][td]Cust2[/td][td]May[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Consumer[/td][td=bgcolor:#E2EFDA]Cust3[/td][td=bgcolor:#E2EFDA]October[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Consumer[/td][td]Cust3[/td][td]November[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Consumer[/td][td=bgcolor:#E2EFDA]Cust3[/td][td=bgcolor:#E2EFDA]December[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Consumer[/td][td]Cust3[/td][td]January[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Consumer[/td][td=bgcolor:#E2EFDA]Cust3[/td][td=bgcolor:#E2EFDA]February[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Consumer[/td][td]Cust3[/td][td]March[/td][td]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#E2EFDA]Consumer[/td][td=bgcolor:#E2EFDA]Cust3[/td][td=bgcolor:#E2EFDA]April[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Consumer[/td][td]Cust3[/td][td]May[/td][td]
1​
[/td][/tr]
[/table]
 
Upvote 0
A crosstab query should work for Access, also. Did you try that?
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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