Stacked Column and Combination Charts with Excel 2010 Sparklines

AID: 4604
  • Status: Published

14370 points

  • By
  • TypeTutorial
  • Posted on2011-02-28 at 16:34:35
Awards
  • Community Pick
  • Experts Exchange Approved
  • Editor's Choice
Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards.

Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a way to create stacked column charts or combination charts with columns overlaid by a line.

But with a bit of preparation and few tools from the trick box, it can be done.

Stacked Column Sparkline



1

Create Sparklines

Start out with two Sparklines, Blue data and Red data. The source data in this example is arranged in a table with two columns, Blue and Red. The goal is to create a Sparkline that stacks the blue columns onto the red ones.

01-Sparklines.png
  • 3 KB
  • A set of standard Sparklines
A set of standard Sparklines



2

Create a Helper Sparkline

To achieve that, first go to the data table and add a helper column that sums the values of Blue and Red. Then create a Helper Sparkline which shows the newly summed data. It looks like this:

02-HelperSparklines.png
  • 2 KB
  • Helper Sparkline
Helper Sparkline



3

Align Y Axes

We need to ensure that all three Sparklines have the same Y axis settings. Select all three Sparklines, click the Design tab of the Sparkline Tools and select the Axis drop-down.

03-SparklineAxes.png
  • 24 KB
  • Set Sparkline Axes options
Set Sparkline Axes options


Set the Vertical Axis Minimum Value to a Custom Value (in the example it is 0 ) and the Vertical Axis Maximum to a Custom Value (in the example it is 10).



4

Create a dynamic image of the Sparkline

Next, select the cell with the Helper Sparkline and use the Copy drop-down on the Home tab and copy the cell as a picture, accepting the default in the Copy Picture dialog.

04-CopyAsPicture.png
  • 10 KB
  • Copy As Picture
Copy As Picture

05-CopyPictureDialog.png
  • 9 KB
  • Accept the Defaults
Accept the Defaults



5

Paste and link

Paste the picture into a cell. This is a static picture and will not update when the Sparkline changes. To make it dynamic, select the picture, then click into the Formula bar, enter a = sign and click on the cell that has the Helper Sparkline.

06-PasteAndLink.png
  • 4 KB
  • Paste and Link to the cell
Paste and Link to the cell


Now the picture is dynamic and will show whatever content is in that cell. Note that the picture has a transparent background (you can see the Excel grid in the background). This is because the source cell has no color fill.



6

Copy second Sparkline

Repeat the Copy Picture process for the Red Sparkline, paste it and link it to the Red Sparkline cell. The transparent picture background is essential for the next step to work, so make sure not to use fill colors in the Red Sparkline cell.



7

Drag to overlay

Now drag the two pictures on top of each other. The Blue one is in the background and the Red one is in front. Since the background of the Red picture is also transparent, the taller blue columns will peek out above the red columns, thus effectively creating a Stacked Column Sparkline.

07-StackedColumnSparkline.png
  • 2 KB
  • Stacked Column Sparkline
Stacked Column Sparkline



Combination Column / Line Chart



The steps are the same as above, but this time the front picture has been taken from a Line Sparkline.
08-RaggedLine.png
  • 1 KB
  • Ragged-looking Line Sparkline picture
Ragged-looking Line Sparkline picture


"" title="Tip"]If the line in the image looks a bit ragged, open the Format Picture dialog and on the Size tab adjust the Height and/or Width by a percentage point. In the example, I changed the Height from 104% to 105% and the ragged line in this screenshot was restored.

Here’s the Combination Column / Line Chart:
 
09-CombinationSparkline.png
  • 3 KB
  • Column / Line Combination Sparkline
Column / Line Combination Sparkline



Some hints and tips



The biggest challenge is probably to align the two images perfectly. If you hold the Alt key while dragging a picture, it will snap to the nearest cell border. First drag and snap the background picture to the upper left corner of a cell, then drag and snap the foreground picture to the same position and they should be perfectly aligned.

Why not simply overlay the Helper data Sparkline with the picture of the foreground Sparkline?

Well, the picture of the Sparkline is not exactly the same size as the cell. It is a few pixels off, enough to be irritating and a pain to resize manually. It’s easier and faster to create two pictures, since they will have exactly the same size, and will align perfectly when placed on top of one another.

Here is the finished Mini-Dashboard. The attached file was created using the steps outlined above. Some of the source data is generated with Randbetween(). Open the file and hit the F9 key to see the Sparkline images update instantly. Enjoy.

 
10-MiniDashboard.png
  • 9 KB
  • Mini Dashboard with stacked column and combination Sparklines
Mini Dashboard with stacked column and combination Sparklines

Comments

Expert Comment

by: dlmille on 2011-04-14 at 23:03:09ID: 25802

Very Cool.  Can't wait to get Excel 2010 at work, and install it at home.  Interestingly enough, I just learned about sparklines for a recent question I answered, where we were using Excel 2007 and I found some code that generates sparklines in that version.  Here's the link to Gerard's library for 2003-2007 users:  http://www.spreadsheetml.com/products.html

Dave

Expert Comment

by: brettdj on 2011-08-17 at 22:44:09ID: 30764

Great article Ingeborg.

I remember liking this when I first read it, and thinking one day this would be useful. Well I have finally clicked that sparklines are an easy method to provide immediate feedback to financial modellers on input assumptions trends - not just dashboard outputs.  They can be added to every row in a financial model at the far left, just before freezing panes, so both row totals/weighted averages and sparkline summaries are always visible. Possible uses including

- quickly showing where there is missing data (which may occur off to the right of the immediate view in big financial models)
- identifying possible errors in data entry or calculations
- reveal trends which may otherwise remain hidden

Cheers

Dave

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top MS Excel Experts

  1. dlmille

    1,351,499

    Genius

    10,680 points yesterday

    Profile
    Rank: Genius
  2. ssaqibh

    542,555

    Sage

    0 points yesterday

    Profile
    Rank: Genius
  3. rorya

    381,757

    Wizard

    4,225 points yesterday

    Profile
    Rank: Savant
  4. imnorie

    334,112

    Wizard

    0 points yesterday

    Profile
    Rank: Genius
  5. teylyn

    282,850

    Guru

    20 points yesterday

    Profile
    Rank: Genius
  6. barryhoudini

    280,460

    Guru

    0 points yesterday

    Profile
    Rank: Genius
  7. redmondb

    235,511

    Guru

    2,000 points yesterday

    Profile
    Rank: Sage
  8. matthewspatrick

    230,947

    Guru

    2,010 points yesterday

    Profile
    Rank: Savant
  9. byundt

    197,840

    Guru

    820 points yesterday

    Profile
    Rank: Savant
  10. zorvek

    144,626

    Master

    0 points yesterday

    Profile
    Rank: Savant
  11. StephenJR

    136,537

    Master

    0 points yesterday

    Profile
    Rank: Genius
  12. nutsch

    117,005

    Master

    0 points yesterday

    Profile
    Rank: Genius
  13. gowflow

    110,036

    Master

    0 points yesterday

    Profile
    Rank: Sage
  14. MartinLiss

    107,333

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  15. GlennLRay

    95,652

    Master

    0 points yesterday

    Profile
    Rank: Guru
  16. robhenson

    90,250

    Master

    0 points yesterday

    Profile
    Rank: Sage
  17. ScriptAddict

    88,470

    Master

    0 points yesterday

    Profile
    Rank: Guru
  18. kgerb

    85,022

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  19. aikimark

    84,456

    Master

    3,310 points yesterday

    Profile
    Rank: Genius
  20. andrewssd3

    80,242

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  21. Wiesje

    69,918

    Master

    0 points yesterday

    Profile
    Rank: Master
  22. Shanan212

    66,418

    Master

    0 points yesterday

    Profile
    Rank: Master
  23. krishnakrkc

    59,548

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  24. Michael74

    54,744

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  25. regmigrant

    51,070

    Master

    0 points yesterday

    Profile
    Rank: Guru

Hall Of Fame