One of the most popular posts on this blog is how to become excel conditional formatting rock star. Quite a few commenters there asked me if there is a way to get more than 3 (or 4) conditional formats in excel 2003. Like what you see below:
You can get more than three conditional formats in excel using VBA / macros. Last week I had sometime to put together a simple VBA script using which you can get more than 3 conditional formats in Microsoft excel. Just follow the below 3 steps.
- Download the VBA Macro for getting more than 3 conditional formats
Just copy the VBA Macro cFormat() to your workbook or place it in wherever you keep all your macros.
- In your workbook, define 3 named ranges.
data2use: This range contains the cells to be formatted.
conditions2use: This range is identical in shape and size to data2use and contains conditions for the data range start from 1 to n (n being the maximum number of conditional formats your would like to have)
formats2use: This range contains “n” cells each formatted in a way you would like to format the cells in data2use range.
See this illustration to understand how these 3 ranges are used to create more than 3 conditional formats:
- Finally hit Alt+F8 (or menu > tools > macro > macros) and run the cFormat macro. The conditional formatting macro you have just downloaded will format the “data2use” range by scanning “conditions2use” range and using the formats in “formats2use” range. If you are curious to see how the VBA script looked like, see the cFormat macro code
- Make sure you have downloaded the workbook with code for getting more than 3 conditional formats in excel
What would you use this trick for? A giant heat map, project plan … ?
My name is Chandoo. Thanks for dropping by. My mission is to make you awesome in Excel & your work. I live in Wellington, New Zealand. When I am not F9ing my formulas, I cycle, cook or play lego with my kids. Know more about me.
Thank you and see you around.
Leave a Reply
|« Excel Links of the Week – The Mt. Rainier edition||The shower curtain & rings sense of designing products »|