Data to change from Columns to Rowns

maheshrk81

Board Regular
Joined
Jan 5, 2010
Messages
146
Hi All,

I have a data as below. Now I need the same with Cust ID, Cust Name and 3rd Column as Fiscal Month and get the Month column to Rows and 4th Column as Amount and get those in rows respectively. Can someone help

Cust ID Cust Name<strike></strike>
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Jul[/FONT]<strike></strike>
Aug<strike></strike>
SepOctNovDecJanFebMarAprMayJun
124abc6546545661556496654676868869963966986335668
416546wer48566986566633666662333533386677
665265thj686462896656666455823363666536698546
65654yui967
9852opz646339
6823tre64933694
57xyz888669
783pqr6983969

<tbody>
</tbody>

Thanks,
Mahi
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
5,155
Office Version
2019
Platform
Windows
Data Range
A
B
C
D
1
Cust ID​
Attribute​
Value​
Custom​
2
124​
Jul​
654654​
abc​
3
124​
Aug​
566​
abc​
4
124​
Sep​
155​
abc​
5
124​
Oct​
6496​
abc​
6
124​
Nov​
65467​
abc​
7
124​
Dec​
686​
abc​
8
124​
Jan​
886​
abc​
9
124​
Feb​
9963​
abc​
10
124​
Mar​
966​
abc​
11
124​
Apr​
9863​
abc​
12
124​
May​
35​
abc​
13
124​
Jun​
668​
abc​
14
416546​
Jul​
48​
wer​
15
416546​
Aug​
56698​
wer​
16
416546​
Sep​
656​
wer​
17
416546​
Oct​
6633​
wer​
18
416546​
Nov​
666​
wer​
19
416546​
Dec​
6623​
wer​
20
416546​
Jan​
335​
wer​
21
416546​
Feb​
333​
wer​
22
416546​
Apr​
8​
wer​
23
416546​
May​
66​
wer​
24
416546​
Jun​
77​
wer​
25
665265​
Jul​
6864​
thj​
26
665265​
Aug​
6289​
thj​
27
665265​
Sep​
66​
thj​
28
665265​
Oct​
566​
thj​
29
665265​
Nov​
6645​
thj​
30
665265​
Dec​
582​
thj​
31
665265​
Jan​
33​
thj​
32
665265​
Feb​
6366​
thj​
33
665265​
Mar​
65​
thj​
34
665265​
Apr​
366​
thj​
35
665265​
May​
98​
thj​
36
665265​
Jun​
546​
thj​
37
65654​
Aug​
967​
yui​
38
9852​
Jul​
646​
opz​
39
9852​
Aug​
339​
opz​
40
6823​
Jul​
649​
tre​
41
6823​
Aug​
33694​
tre​
42
57​
Jul​
888​
xyz​
43
57​
Aug​
669​
xyz​
44
783​
Jul​
698​
pqr​
45
783​
Aug​
3969​
pqr​
Using Power Query, here is the Mcode

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Cust ID", Int64.Type}, {"Cust Name", type text}, {"Jul", Int64.Type}, {"Aug", Int64.Type}, {"Sep", Int64.Type}, {"Oct", Int64.Type}, {"Nov", Int64.Type}, {"Dec", Int64.Type}, {"Jan", Int64.Type}, {"Feb", Int64.Type}, {"Mar", Int64.Type}, {"Apr", Int64.Type}, {"May", Int64.Type}, {"Jun", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Cust ID"}, "Attribute", "Value"),
    #"Added Custom" = Table.AddColumn(#"Unpivoted Other Columns", "Custom", each if [Attribute] = "Cust Name" then [Value] else null),
    #"Filled Down" = Table.FillDown(#"Added Custom",{"Custom"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Attribute] <> "Cust Name"))
in
    #"Filtered Rows"
 

sandy666

Well-known Member
Joined
Oct 24, 2015
Messages
4,667
shorter:

Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    UnpivotOC = Table.UnpivotOtherColumns(Source, {"Cust ID", "Cust Name"}, "Month", "Value")
in
    UnpivotOC[/SIZE]
 
Last edited:

Forum statistics

Threads
1,089,278
Messages
5,407,347
Members
403,135
Latest member
becca_832313

This Week's Hot Topics

Top