Last week, I showed you how to use Excel’s Conditional Formatting menu to add cell formats to highlight specific data values. Here, I’ll show you how to easily use the Color Scales options in that menu to create a Heatmap.
Simply put, a heatmap is a table where the data are visualized using color. They pop up fairly regularly these days, sometimes showing the actual data values and sometimes not, like these two I pulled from FlowingData.
I’ll use the OECD Better Life Index data again to create this heatmap. First, select a column of data, navigate to the Conditional Formatting menu on the Home tab, select Color Scales and More Rules…
Here, you are able to choose the specific color palette you want to use, selecting the color for the lowest and highest values. The default color range is orange for the Lowest Value and a yellow for the Highest Value. I’m not sure why the default is opposite the way most of us would use color to encode data (with darker colors encoding higher values), so you’re going to have to switch those around. (Also note that the Mac and PC versions of this menu do look fairly different, but they work in the same way.)
I’ve completed the first 5 columns here, each with a different color scale. Be sure to select each column individually. If you apply the format to a group of columns, they will use the same color ramp and Excel will assume they are drawn from the same distribution.
Hide the Numbers
This is a decent heatmap and you can see some of the patterns emerging. There are times, however, when you might like to create a heatmap without seeing the actual data values, to create something like this:
When I ask people how they would hide the numbers and keep the colors, I typically hear a couple of guesses: Either delete the numbers or turn them to white. Though easy, neither work: In the former, the text and the colors both disappear—they are linked to the data, remember? In the latter, you can still see them through the color scales, so they’re not hidden, just a different color.
So what to do? Well, we can use a little number formatting trick to hide the data values while maintaining the conditional formatting. Select the entire heatmap and then right-click to select Format Cells. (An easier way is to use the CTRL+1 (PC) or CMD+1 (Mac) keyboard shortcut, which, by the way, is my favorite Excel keyboard shortcut of all time and works for every object in Excel including parts of your charts such as axes, backgrounds, and lines.)
At the bottom of the Format Cells menu is the Custom option. I won’t go into how Excel does its custom number formatting here (Excel Tactics has a terrific post on Excel number formats), but there are basically four slots, each separated by a semicolon: <Positive Numbers>;<Negative Numbers>;<Zeros>;<Text>.
In our example, type in three semicolons (“;;;”) into the Type: box.
Click Ok and your numbers will be hidden, but are still there and available for you to use or modify, and the colors remain. Neat little trick, eh?
IS IT POSSIBLE TO CRETE HEAT MAP FORM MORE THAN ONE COLUMN.
IS IT POSSIBLE TO CRETE HEAT MAP FORM MORE THAN ONE COLUMN in excel
To use this approach, you need to do one column at a time. The conditional formatting is applied to all of the data at the same time, so choosing two columns will yield the same formatting in both.
Hi,
I made a heat map but how can I create a color sclale bar with the heatmap?
Do you mean with bars instead of coloring the entire cell? There is a bar option in the same Conditional Formatting menu that works in the same way as the method described above.
Hi,
Thank you it was very useful for me. Is it possible to add a scale bar – a ruler ,not bars instead of coloring entire cell
You can add bars using the “Data Bars” option or you can add sparklines using the Sparklines menu. If you still want to use colors and add a legend, you can do so by separately coloring some cells and adding text. I hope that makes sense. If you want a literal “ruler”, I think I’d need to see the exact example, which you can either post here or send to me using the contact form.
I mean a color key. see the attached file pls.
Attached image:
Sure, I think you can do this by simply adding another row (or set of cells) such that you have one cell equal to the minimum of your series and the other set to the maximum. Then fill in the middle cells with a linear interpolation. Then apply the same conditional formatting rules to those cells. See the last row in this example.
Attached image:
This was very helpful – thank you!
A 3D Warehouse Heat Map in MS Excel (by Adrián Chiogna).
https://es.slideshare.net/HECTORADRI/a-3d-warehouse-heat-map-in-ms-excel-by-adrin-chiogna
Attached image: