fbpx
Search
Close this search box.

Market Segmentation Charts using Conditional Formatting

Share

Facebook
Twitter
LinkedIn

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)

Product and Segments Data for your Market Segmentation Charts

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.

Market Segment Chart - Raw

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)
Conditional Formatting Rules - Excel 2007 - Market Segmentation Charts

Custom Format Code for Making Cells Invisible - Microsoft Excel
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]

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

10 Responses to “Market Segmentation Charts using Conditional Formatting”

  1. Hypnos says:

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

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

  2. Hypnos says:

    And I did not understand one bit of it.

    You should get into teaching QT at IIMs.

  3. Stružák says:

    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. 🙂

  4. Chandoo says:

    @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.

  5. Stružák says:

    @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. 🙂

  6. A V MANGAPATHI RAO says:

    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.

  7. Silvia says:

    Dear,

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

  8. raj k says:

    Market segmentation charts
    the explanation is it complete bouncing.
    I just confused what you are treid to explain, & how you narrated it above ?

Leave a Reply