To add values to a treemap in Excel, you must organize your data into a hierarchical table where categories are in the left columns and numerical values are in the rightmost column. Excel uses the size of the rectangles to represent these values, automatically scaling the boxes based on the numbers provided in your data range.
What You'll Need
- Microsoft Excel (2016 or newer, as treemaps were introduced in the 2016 version).
- A dataset containing at least one category (text) and one value (number).
- Data organized in a tabular format without empty rows or columns within the range.
Step-by-Step
- Organize Your Data: Arrange your data in columns. For a simple treemap, use two columns: one for the label (e.g., "Product Name") and one for the value (e.g., "Sales"). For a hierarchical treemap, use multiple columns for categories (e.g., "Region," "Category," "Product") and the final column for the numerical value.
- Select the Data Range: Click and drag your mouse to highlight the entire range of cells, including the column headers. Ensure you do not select entirely empty rows or columns, as this can cause errors in chart generation.
- Insert the Treemap: Go to the Insert tab on the top ribbon. In the Charts group, click the icon for Hierarchy Chart (it looks like a small group of nested rectangles) and select Treemap from the dropdown menu.
- Verify Value Mapping: Excel automatically assigns the rightmost numerical column as the "value" that determines the size of the rectangles. If the chart appears empty or incorrect, check that your value column contains only numbers and no text or symbols (like currency symbols typed manually instead of formatted via Cell Styles).
- Add Data Labels: By default, Excel usually displays the category name. To ensure values are visible, right-click any rectangle in the chart and select Format Data Series. In the pane that opens on the right, look for Label Options.
- Customize Label Content: Under the Label Options section, you can choose what to display. While standard treemaps primarily show the category name, you can modify the text in your original data cells to include the value (e.g., "Apples - $500") if you want the specific number to appear inside the box, as Excel's native treemap labels are limited compared to bar charts.
- Adjust the Layout: Use the Chart Design tab to change the color scheme or style to make the different value groupings more visually distinct.
Common Mistakes
- Including Zero or Negative Values: Treemaps cannot display negative values or zeros. If your data contains these, Excel will either ignore them or produce an error message stating that the chart cannot be created.
- Incorrect Column Order: Placing the numerical value in the first column instead of the last. Excel expects the hierarchy to move from left to right, ending with the value.
- Using Merged Cells: Merged cells in the data source often confuse the chart engine, leading to "Invalid Data" errors. Always use unmerged, clean tables.
- Too Many Categories: Adding hundreds of small values can make the treemap unreadable, as the rectangles become too small to display labels.
Tips
- Use Tables: Convert your data range into an official Excel Table (Ctrl + T) before creating the treemap. This ensures that if you add new rows of data, the treemap updates automatically.
- Simplify Hierarchies: Limit your hierarchy to 2 or 3 levels. Too many levels of nesting make the visualization cluttered and difficult for the viewer to interpret.
- Contrast Colors: Use the Change Colors option in the Chart Design tab to ensure that the different categories are easily distinguishable.
- Combine Labels: Since Excel doesn't have a "Show Value" checkbox for treemap labels like it does for pie charts, create a helper column using a formula like
=A2 & " (" & B2 & ")"to combine the name and value into one string, then use that column for your labels.
Troubleshooting
If your treemap is not displaying correctly, try these steps in order:
- Check for Non-Numeric Data: Ensure the value column contains only numbers. If a number is stored as text (indicated by a small green triangle in the cell corner), select the cells and click the warning icon to Convert to Number.
- Remove Blank Rows: Delete any completely empty rows or columns within your selected data range.
- Verify Version: If you do not see the Hierarchy Chart option under the Insert tab, you may be using a version of Excel older than 2016. Treemaps are not available in Excel 2013 or earlier.
- Reset the Range: Right-click the chart, choose Select Data, and re-highlight the range to ensure no stray cells are being included in the calculation.
Frequently Asked Questions
Can I show the exact numerical value inside the treemap box?
Excel's default treemap labels only show the category name. To show the value, you must create a "helper column" in your data that combines the name and the value into one text string using a formula, and then use that column as the category label.
Why is my treemap showing as one giant box?
This usually happens if you only have one category or if all your values are identical. It can also happen if Excel is misinterpreting your value column as text rather than numbers.
Can I have multiple value columns in one treemap?
No, a treemap can only represent one numerical value per rectangle to determine its size. If you have multiple values, you will need to create separate treemaps for each metric.
How do I change the colors of specific boxes?
You can click once to select the whole series, then click a second time to select a specific rectangle. With that single box selected, go to the Format tab and use Shape Fill to change its color.
Does the treemap update when I change the numbers?
Yes, treemaps are dynamic. If you change a value in your source table, the size of the corresponding rectangle will automatically adjust to reflect the new proportion.