Flat hierarchy -> Treemap/Sunburst Chart

jahsquare

Board Regular
Joined
Jan 22, 2014
Messages
51
Hi, I have hierarchical data in a named range "Table1" that looks like below, where the "Count" is the value for each Category, and The "Cumulative Count" is the sum of the current level and all child levels. Is there a way to quickly get this into a format to use the Treemap or Sunburst plots?

It would be amazing if I could do it withoug using the Cumulative Count column as generating that column on my dataset (250k records) requires an expensive calculation. The solution here looks close but doesn't quite get the format for the charts.

As a further step I would really like there to be a dynamic range (on another sheet) where I could enter e.g. "A" into a cell and the output range & chart would update automatically with the sub-categories starting with "A".

[TABLE="width: 325"]
<tbody>[TR]
[TD]Count[/TD]
[TD]Cumultative Count[/TD]
[TD]Level[/TD]
[TD]Category Name[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD]A1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]7[/TD]
[TD]A2[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD]8[/TD]
[TD]A3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]10[/TD]
[TD]5[/TD]
[TD]A4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]A5[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]A6[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]A7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]A8[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]5[/TD]
[TD]9[/TD]
[TD]A9[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]3[/TD]
[TD]5[/TD]
[TD]B1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]7[/TD]
[TD]B2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]8[/TD]
[TD]B3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]9[/TD]
[TD]B4[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]B5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]9[/TD]
[TD]B6[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]B7[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]11[/TD]
[TD]B8[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]B9[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]B10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]9[/TD]
[TD]B11[/TD]
[/TR]
</tbody>[/TABLE]


Thanks for any insight.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
* I can't figure out how to edit my post but the input data should have A, B, and C categories


[TABLE="class: cms_table"]
<tbody>[TR]
[TD]Count[/TD]
[TD]Cumultative Count[/TD]
[TD]Level[/TD]
[TD]Category Name[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD]A1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]7[/TD]
[TD]A2[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD]8[/TD]
[TD]A3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]10[/TD]
[TD]5[/TD]
[TD]B1
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]B2
[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]B3
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]B4
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]B5
[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]5[/TD]
[TD]9[/TD]
[TD]A6
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]3[/TD]
[TD]5[/TD]
[TD]C1
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]7[/TD]
[TD]C2
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2[/TD]
[TD]8[/TD]
[TD]C3
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]9[/TD]
[TD]C4
[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]C5
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]9[/TD]
[TD]C6
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]C7
[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]11[/TD]
[TD]C8
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]C9
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]C10
[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]9[/TD]
[TD]C11
[/TD]
[/TR]
</tbody>[/TABLE]


So for a Sunburst the output table would look like this:

[TABLE="width: 448"]
<colgroup><col style="width:48pt" span="7" width="64"> </colgroup><tbody>[TR]
[TD="width: 64"]L5[/TD]
[TD="width: 64"]L7[/TD]
[TD="width: 64"]L8[/TD]
[TD="width: 64"]L9[/TD]
[TD="width: 64"]L10[/TD]
[TD="width: 64"]L11[/TD]
[TD="width: 64"]Count[/TD]
[/TR]
[TR]
[TD]A1[/TD]
[TD]A2[/TD]
[TD]A3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]B1[/TD]
[TD]B2[/TD]
[TD]B3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]B4[/TD]
[TD]B5[/TD]
[TD]B6[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD]C1[/TD]
[TD]C2[/TD]
[TD]C3[/TD]
[TD]C4[/TD]
[TD]C5[/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]C6[/TD]
[TD]C7[/TD]
[TD]C8[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]C9[/TD]
[TD]C10[/TD]
[TD]C11[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]


And the plot would look like this: https://imgur.com/NcH6g0s
 
Upvote 0

Forum statistics

Threads
1,226,112
Messages
6,189,039
Members
453,520
Latest member
packrat68

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