Treemap Excel Tutorial: Visualize Hierarchical Data
In this article
A treemap in Excel is a specialized chart that uses nested rectangles to represent a hierarchy of data. It achieves two things simultaneously: it shows the relative size of a category (via the area of the rectangle) and the grouping of items within that category. This is ideal for visualizing large datasets where you need to identify which specific items are driving a total value, such as seeing which product lines contribute most to total company revenue. To get started, you need a dataset organized in a tabular format with at least one categorical column and one numerical value column.
What You'll Need
- Microsoft Excel (2016 or newer, as treemaps were introduced in the 2016 version).
- A dataset with a clear hierarchy (e.g., Category > Sub-category > Item).
- Numerical values associated with the lowest level of your hierarchy (e.g., Sales, Cost, or Quantity).
- Data cleaned of empty rows or columns within the selection range.
Step-by-Step
- Organize Your Data Structure: Before inserting the chart, your data must be arranged in a specific hierarchy from left to right. For example, if you are tracking sales, Column A should be the "Region" (Broadest), Column B should be the "Store" (Middle), and Column C should be the "Product" (Specific). Column D should contain the numerical values. Ensure there are no merged cells and that every row has a value; otherwise, Excel may struggle to group the rectangles correctly.
- Select the Data Range: Click and drag your mouse to highlight the entire range of data, including the headers. For instance, if your data spans from cell A1 to D50, select that entire block. Including the headers is critical because Excel uses these labels to name the categories in the chart legend and tooltips.
- Insert the Treemap Chart: Navigate to the top ribbon. Click on the Insert tab. In the Charts group, look for the Hierarchy Chart icon (which typically looks like a small set of nested squares). Click the dropdown arrow and select Treemap. Note that menu labels may differ slightly depending on your version of Excel or regional settings.
- Verify the Layout: Once the chart appears, Excel will automatically group your data based on the columns you selected. The largest rectangles represent the largest values. If you have a hierarchy (Region > Store > Product), you will see large boxes for Regions, and inside those, smaller boxes for Stores, and inside those, even smaller boxes for Products.
- Customize the Colors: To change the visual appearance, right-click on one of the rectangles in the chart and select Format Data Series. A pane will appear on the right. Under the Series Options, you can adjust the gap width or change the color palette. You can also go to the Chart Design tab in the ribbon and select Change Colors to choose a preset color scheme that differentiates your top-level categories.
- Add and Format Data Labels: By default, Excel may only show the labels for the largest rectangles. To ensure all information is visible, click the Chart Elements button (the green plus sign next to the chart) and check the Data Labels box. To refine these, click the arrow next to Data Labels > More Options. In the Label Options pane, you can choose to display the "Category Name" and the "Value" so the viewer knows exactly what the size of the rectangle represents without hovering.
- Fine-Tune the Chart Title: Click on the default "Chart Title" text box and type a descriptive name, such as "Annual Sales Distribution by Region and Product." Use the Home tab to bold the text or increase the font size for better readability.
Common Mistakes
One of the most frequent errors is including a "Total" row at the bottom of the dataset. If you include a sum of all values in your selection, Excel will treat that total as its own category. This results in a massive rectangle that takes up half the chart, pushing all other data into tiny, unreadable slivers. Always exclude totals and subtotals from your selection range.
Another common mistake is using non-numeric data in the value column. If a cell contains a typo (like "100$" instead of "100") or a dash instead of a zero, Excel may treat the entire column as text. This will prevent the Treemap from generating because it cannot calculate the area of a rectangle based on text. Ensure your value column is formatted as a Number or Currency.
Users also often forget to maintain a consistent hierarchy. If some rows have a "Region" and "Store" but others only have a "Region," the chart can look disjointed. While Excel can handle some gaps, the most professional results come from a fully populated table where every item belongs to a sub-category, and every sub-category belongs to a main category.
Tips
To make your Treemap more interactive, consider converting your source data into an official Excel Table (Ctrl + T). When your data is in a Table, any new rows you add to the bottom will automatically be included in the Treemap. You won't have to manually re-select the data range and re-insert the chart every time your data updates.
If you have too many small categories, the Treemap can become cluttered with tiny boxes that have no room for text. To solve this, use a filter on your source data to remove the "long tail" of insignificant values. By focusing only on the top 20-30 items, the visualization becomes a powerful tool for decision-making rather than a confusing mosaic of pixels.
Combine your Treemap with a Slicer for a dynamic dashboard. If your data is in a Table, go to Table Design > Insert Slicer. Select the "Region" or "Year" column. Now, when you click a button on the slicer, the Treemap will instantly update to show only the data for that specific selection, allowing you to drill down into the hierarchy visually.
Troubleshooting
The chart is blank or shows an error: This usually happens because of data types. Check your value column for any cells containing text, errors like #N/A, or hidden spaces. Clear any formatting and set the column to "Number." If the issue persists, try selecting only two columns (one category and one value) to see if the problem lies in the hierarchical structure of your other columns.
Labels are missing or overlapping: Treemaps automatically hide labels that don't fit in the rectangle. To fix this, you can either increase the overall size of the chart by dragging the corners, or you can change the label settings to "Value Only" to save space. Alternatively, simplify your category names; "North American Sales Region" takes up more room than "North America," making it more likely to be hidden.
The hierarchy is grouped incorrectly: If Excel is grouping your "Products" as the main category instead of "Regions," check the order of your columns. Excel reads the hierarchy from left to right. The leftmost column is always the top level of the hierarchy. Rearrange your columns so the broadest category is in Column A and the most specific is in the column immediately preceding the values.
The chart is slow to update: If you are working with thousands of rows, the Treemap can lag. To resolve this, create a Pivot Table first to summarize your data into a smaller set of totals, and then build the Treemap based on the Pivot Table results rather than the raw data.
Frequently Asked Questions
Can I create a Treemap in Excel 2013 or older?
No, the Treemap chart type was officially introduced in Excel 2016. If you are using an older version, you would need to use a third-party add-in or manually create a similar visual using shapes, which is not recommended for dynamic data.
Does a Treemap support negative values?
No, Treemaps cannot display negative values because they rely on the area of a rectangle to represent magnitude. A rectangle cannot have a negative area. If your data contains negative numbers, you should use a Bar Chart or a Waterfall Chart instead.
How is a Treemap different from a Pie Chart?
While both show proportions of a whole, a Pie Chart only handles one level of data. A Treemap can handle multiple levels of hierarchy (categories and sub-categories) and is much more efficient at displaying a large number of items without becoming a "rainbow slice" mess.
Can I change the order of the rectangles?
Excel automatically orders Treemap rectangles from largest to smallest, starting from the top-left. You cannot manually drag and drop rectangles to a different position; the order is strictly determined by the numerical values in your data.
Can I use a Treemap for time-series data?
Generally, no. Treemaps are for snapshots of proportions at a specific point in time. To show how data changes over time, a Line Chart or Area Chart is the correct choice. Using a Treemap for time-series data would be confusing as the rectangles would shift sizes and positions unpredictably.