Approach with caution

Multi-select regions on an interactive Excel Dashboard

Have you ever built a data-analysis model in Microsoft Excel for a database containing a geographical dimension like state, county, ZIP-code areas, sales region, etc.? If so you probably wanted to integrate a user-friendly control feature on your dashboard that enables the user not only to select one region, but to filter the data by any combination of regions. E.g. show the total revenues for the sales regions West and Central.

You need a multi-select filter control. This post shows different options of how to do this and includes the example files for free download.

A preliminary remark

I am living in Germany and ~80% of my clients are based in Germany. So it is no big surprise that I am using the states of Germany in my examples. Probably pretty useless if you are living in the United States, France or India, but it should be no sweat to adopt the techniques to any other set of regions.

Option 1: A list with checkboxes

This is the easiest way to allow multi-select inputs and does not need VBA. Create a list of all regions on your dashboard and add one checkbox from the form controls toolbar for every region.

Multiselect Checkboxes - click to enlarge

Here is the file for download:

Download Multiselect regions with checkboxes simple (Excel 97 – 2003, 62.5K)

If you want to, you could add 2 small buttons and write 2 simple VBA macros to check all and uncheck all with one click. Another good enhancement would be conditional formatting to highlight the selected rows with e.g. a darker fill color or a bold font.

Download the enhanced workbook here:

Download Multiselect regions with checkboxes enhanced (Excel 97 – 2003, 71.5K)

Option 2: A Multi-select ListBox

This is still pretty straight forward, but you need some knowledge about VBA. Add a ListBox from ActiveX Control toolbar, set the multiselect property to 2, define the fill range and write a small VBA routine to handle the user selection. Well, I admit this was a pretty condensed how-to, but any search engine, a book about VBA or even Excel’s help function will provide all further information you may need.

Multiselect Listbox - click to enlarge

The ListBox is usually my favorite since it is quick and easy to implement and needs the least amount of real estate on the dashboard.

Download the file:

Download Multiselect regions with ListBox (Excel 97 – 2003, 64.5K)

Care for something more fancy? Here you go:

Option 3: Clicking on a map

How about using an interactive map? Let the user select and deselect regions by clicking on the map and highlight the selected regions with a darker fill color. All you need is a map with editable regions (i.e. every region is one shape), names for the shapes (same procedure as if you would define a name for a range) and a couple of very small VBA-routines assigned to the shapes. That’s it.

Multiselect Interactive Map - click to enlarge

Here is the file for download:

Download Multiselect regions with an interactive map (Excel 97 – 2003, 108.5K)

Please use this with caution!

Having an interactive map as a filter control is a nifty little feature for a dashboard. But please: before using this technique, answer the following questions:

  • Do you have enough real estate on your dashboard for a map?
    Usually real estate is the limiting factor on a dashboard. Don’t waste it for a fancy user interface. Use it for visualizing data and presenting information rather than for a nice interactive feature. If you have enough real estate, fine. If not, use a ListBox instead of a map.
  • Are all users of your dashboard familiar with the location of the regions on the map?
    I, for one, am familiar with the German map in this example and I guess I would even be able to name all the states on a European map correctly. What about a map of the United States? Well, I would find California, Colorado, Washington, Florida and some other. But I am ashamed to admit: I do not know where Nebraska is. Somewhere in the Midwest, correct? But which one? You can imagine that I don’t know Wyoming either. I apologize to everyone living there and reading this. I am embarrassed. Even if you are better at geography than I am: How about the countries of Central Africa, the British counties or French ZIP-code areas. Got my point?
  • Is the map on your dashboard large enough to allow the user to click on every region with ease?
    A picture says a thousand words. This is a map of Europe: 

Map Europe - click to enlarge

Are your eyes good enough and your hands calm enough to click on Luxembourg (on the original map, not on the magnified part)?
If they are, congratulations, but I guess this will not be the case for most of the users of your dashboard. From my point of view a European map of this size is definitely out of the race.

So please do the users of your dashboard and yourself a big favor: Before putting an interactive map for filtering on your dashboard, make sure the answer to all three questions is “yes”. And stick by it! If you have the least doubt, don’t use the map, use a ListBox instead.

Option 4: Clicking on a tag cloud

You can’t use a map but you still want to have something niftier than a ListBox? How about an interactive tag cloud?

Multiselect Tag Cloud - click to enlarge

The names of the regions are displayed, the regions can be selected and deselected by clicking and the selected items are highlighted by blue bold texts. What’s the difference to the ListBox? Since it is a tag cloud, the size of the texts represent the weight of the regions, in this example the population. The technique is pretty much the same as for the interactive map, except for using textboxes instead of shapes. Please note that the file for download does not include the routine to create a tag cloud, i.e. determine the different sizes of the textboxes. Maybe I will have another post on creating tag clouds some later day.

Nevertheless, here is the file for download:

Download Multiselect regions with a tag cloud (Excel 97 – 2003, 119.5K)

Comments

5 responses to “Approach with caution”

  1. Henrique Avatar
    Henrique

    Robert,
    I´m a bia fan of your job. So, I decide to read your blog entirely.
    This post is just awesome!
    In the end, you talk about tag clouds in excel, but i couldn´t find much details in the spreadsheet. I´ve already looked in chandoo´s post but the code is not clear for me.
    If you don´t mind, could you talk a little more about this data viz?
    And another question: By the recent excel classes from your mates Chandoo´s and (next) Excel Hero, do you have any plans on teaching us too? I would be very glad with this!
    Cheer´s from Brazil!

  2. Robert Avatar

    Henrique,
    thanks for your comment and the compliments.
    As mentioned in the article, the workbook posted for download does not include the VBA that produced the tag cloud.
    In general you have 2 different approaches to do this: either you have all words in one cell and change the font sizes of the words using VBA (like Chandoo did in his implementation Create Cool Tag Clouds in Excel using VBA) or you are creating textboxes for all words with different font sizes. I am still having this on my list of possible blog posts, but I do not use tag clouds very often, thus this does not have highest priority at the moment.
    I am sorry, but I am not planning to offer Excel classes. I am convinced that with Chandoo’s Excel School and Daniel Ferry’s Excel Hero Academy the majority of topics for teaching intermediate and advanced Excel users will be covered.
    I doubt that I can contribute something valuable here.

  3. Jie Avatar
    Jie

    Hello Robert
    In your Option 4: Clicking on a tag cloud, the textbox type is Const msoTextBox = 17 (&H11),Could you please tell me how did you create such shape?
    As when i insert textbox from developer tab its type is
    msoOLEControlObject(const 12).
    I have spent whole day try to figure this out and i still dont have a clue.
    BTW, you site is amazing!!I have learned such much from it. Thank you.

  4. Robert Avatar

    Jie,
    thanks for your comment and for the compliment. The textboxes used for the tag cloud aren’t ActiveX textboxes from the developer tab. They are simple textboxes from the shapes gallery. The VBA only toggles between “selected” and “not selected” and changes the font color and the font to bold / not bold.
    Does this answer your question?

  5. Jie Avatar
    Jie

    Hello Robert
    Thank you for pointing out the direction, finally I got it working.
    Brilliant!Thanks

Leave a Reply to Robert Cancel reply

Your email address will not be published. Required fields are marked *