# Market Segmentation Charts using Conditional Formatting

Trust * Peltier* to come up with solutions for even the most impossible looking charts. Today he shares a marimekko chart tutorial.

**What in the name of unindented VBA code is a Marimekko Chart ?**

**It is a variable width stacked chart.** It is a good way to depict how various segments have performed wrt a set of products, essentially a market segmentation chart. See a sample chart that Jon created to the right.

I couldn’t sit still after seeing his post. So here comes market segmentation charts or marimekko charts using, <drum roll> conditional formatting.

See it for yourself, a market segmentation chart drawn in a 20×20 range of cells.

Here is a brief tutorial on how I created this. With little time and a strong coffee you can build a market segmentation chart too.

### 1. Adjust the data of your market segments and products

While Jon’s data (image) is oriented such that products are in columns and segments are in rows, I created the below structure as it directly maps to how the chart is drawn (segments in columns and products in rows)

I have derived the below table using formulas. It uses the number 20 (which is the size of one side of our conditional chart) and some rudimentary formulas to derive the numbers 0,8,14,18 from 40%,30%,20%,10% and so on. *How ?* Now would be the good time to take a sip of that strong coffee and think hard looking out of the window.

### 2. Create a simple 20X20 grid and start writing formulas

Ok, this is the tricky part. Ideally when the chart is ready we want to have 4 colored regions in each of the 4 segments (this can change if you have more products or more segments). Imagine you were to just write numbers in that grid such that for first product we write number “1” in each segment cells and second product, number “2” so on. Then, color all 1s, 2s, 3s and 4s differently using conditional formatting, then this is how it would look.

Now, we need to just figure out a simple formula that can automatically determine whether to output 1 or 2 or 3 or 4. ENTER THE STRONG COFFEE (or your favorite drink), slurp, slurp…

Ok, did you see those running numbers in the first column and row ? Good, We need to use those numbers to figure out certain things for us.

I have written the following formula in first cell in the 20×20 grid and copy pasted it all over the range.

`=CHOOSE(MATCH(I$4,$C$13:$F$13,1), MATCH($H24,$C$14:$C$17,1), MATCH($H24,$D$14:$D$17,1), MATCH($H24,$E$14:$E$17,1), MATCH($H24,$F$14:$F$17,1))`

**What is it doing ? ** It is checking which segment the current cell belongs to by matching the top-row number with derived table’s first row (0,8,14,18). So for cell 1 this would be 1, for cell 12 this would be 3. Then, CHOOSE formula uses this information to determine which MATCH formula to run, there are 4 match formulas, each for one segment. All of them check the first-column running number with product-wise start numbers derived in the table 2 above. Slightly lost? Well, me too. Sip once more and read from beginning until it makes some sense.

### 3. Finally, apply the conditional formatting

Ok, now select the 20×20 grid and apply conditional formatting. Since I have created this in Excel 2007, I could define 4 rules, one for each number. But You can do similar using Excel 2003 (just define 3 rules, one for each number and apply 4th color to the entire range)

Also, hide the cell contents in the 20×20 grid by applying custom format code like this.

Thats all, you are now all set to show off your market segment chart. Go flaunt.

**Download the market segment charts template and play around.** [*Excel 2007 File*]

### Do you want to be awesome in Excel?

**Here is a smart way to become awesome in Excel**. Just signup for my Excel newsletter. Every week you will receive an Excel tip, tutorial, template or example delivered to your inbox. What more, as a joining bonus, I am giving away a 25 page eBook containing **95 Excel tips & tricks**. Please sign-up below:

Your email address is safe with us. Our policies

### Leave a Reply

Google Spreadsheets Introduces Data Validation, Sweet! |
Welcome Robert & ClearlyAndSimply.com to Blogging |

## 10 Responses to “Market Segmentation Charts using Conditional Formatting”

Copycat!

"what in the name of unindented VBA code..."

hilarious. I've always been a fan of your wit macha...

And I did not understand one bit of it.

You should get into teaching QT at IIMs.

I use conditional formatting very often. As the maximum number of rules (3 in E2003) is annoying to me, I use macros to format the cells. Using variations of the macro below, you can define as much rules as you need.

Dim xy As Range

For Each xy In Range("defined_range")

Select Case .Value

Case 1

xy.Interior.ColorIndex = 44

Case 2 To 10

xy.Interior.ColorIndex = 36

Case 11 To 15

xy.Interior.ColorIndex = 15

Case 16 To 20

xy.Interior.ColorIndex = 48

Case 21 To 30

xy.Interior.ColorIndex = 4

End Select

Next xy

Please, let me know if there is an easier way to go.

@Jon: copychart

@Hypnos: aw... come on, you should understand something. QT at IIMs... ok, should I be insulted or what ? 😛

@Struzak: That is a cool VBA code you have got. I think 2003's limit of 3 conditional formats kind of sucks. They rectified it in 2007 although some people say CF in 2007 is slightly buggy (I haven't faced any issues till now)

Btw, did you check: http://chandoo.org/wp/2008/10/14/more-than-3-conditional-formats-in-excel/ where I have shared a piece of VBA code that would let you create more than 3 conditional formats based on conditions and formats that are totally externalized. It might help you.

@Chandoo: I've seen it. I think that both codes (yours and the one suggested by me) have its advantages and disadvantages.

Yours is optimal for more complicated formatting, the formatting itself is more simple and easier for imagination. On the other hand, it requires external data.

Using Select .. Case might be more suitable for simple formats (such as Interior.ColorIndex), does not require any external input, but sometimes it ain't easy to break the code and see the colors behind the figures.

It's good to have an option which solution to choose. Thanks.

Thank you very much chandoo. I've learnt a lot on conditional formatting through your examples. Really you are giving a great resource to learners of MS Excel.

Dear,

I'm trying to use this app but I don't understand this graphic, could you help me, please?

[…] Market segmentation charts using Excel […]

Market segmentation charts

the explanation is it complete bouncing.

I just confused what you are treid to explain, & how you narrated it above ?