Peltier Technical Services, Inc.
 

Excel Chart Add-Ins | Training | Charts and Tutorials | Peltier Tech Blog


Peltier Tech Charts for Excel 3.0

 

Stacked Column Charts that Cross the X Axis.

Stacked column and stacked bar charts are handy chart types. And with invisible columns (no border and no fill in the column), you can get columns that float above the X axis of your chart, or that sink below the X axis. But what if you want to show columns that span the X axis? How can you make a bar start below the axis and end above it?

Excel has no built in Stacked ± Column chart type. And in fact you can't span a column across the axis. But you can draw each bar in two parts, the above zero part, and the below zero part. Format the pair identically, and nobody will be the wiser.

I'll show an example that uses worksheet formulas to determine which of the columns spans the X axis, or whether all of the stacked columns are above or below the axis. The following data shows steadily improving investment returns among the stockbrokers of a fictitious trading firm. In year one, 100% of the accounts have a negative return. In year two, the upper quartile of the accounts range from below zero to above zero. And each year the next quartile also reaches above zero, until in year six, all of the accounts are making money.

 

A

B

C

D

E

F

G

1

 

Values

2

 

Year 1

Year 2

Year 3

Year 4

Year 5

Year 6

3

100%

-2%

6%

11%

15%

19%

23%

4

75%

-7%

-1%

5%

9%

12%

17%

5

50%

-12%

-6%

-2%

4%

7%

12%

6

25%

-15%

-9%

-5%

-2%

2%

7%

7

0%

-18%

-12%

-9%

-7%

-2%

3%

For each band we depict in the chart, we actually need two series, positive and negative. We also need two blank series, for the space between the axis and the nearest point, in case all points are above or below the axis. I've placed the formulas in the range just below the original data, with the positive series in the top of the table and the negative series in the bottom; this placement isn't too important. The order of the rows within the positives and within the negatives is important, because as Excel works its way down the rows of the data range, it starts next to the axis and each stack is further from the axis.

 

A

B

C

D

E

F

G

8

 

Column Heights

9

 

Year 1

Year 2

Year 3

Year 4

Year 5

Year 6

10

Blank

0%

0%

0%

0%

0%

3%

11

Bottom 25%

0%

0%

0%

0%

2%

4%

12

25-50%

0%

0%

0%

4%

5%

5%

13

50-75%

0%

0%

5%

5%

5%

5%

14

Top 25%

0%

6%

6%

6%

7%

6%

15

Blank

-2%

0%

0%

0%

0%

0%

16

Top 25%

-5%

-1%

0%

0%

0%

0%

17

50-75%

-5%

-5%

-2%

0%

0%

0%

18

25-50%

-3%

-3%

-3%

-2%

0%

0%

19

Bottom 25%

-3%

-3%

-4%

-5%

-2%

0%

The magic of the formulas is what makes the numbers come out right. The formulas are not even very difficult; it just takes a little effort to keep them straight. Here are the formulas from column B. These can be copied and pasted into the rest of the columns.

 

A

B

C

D

E

F

G

8

 

Formulas in Column B

9

 

Year 1

Year 2

Year 3

Year 4

Year 5

Year 6

10

Blank

=IF(B7>0,B7,0)

11

Bottom 25%

=IF(B6>0,IF(B7>0,B6-B7,B6),0)

12

25-50%

=IF(B5>0,IF(B6>0,B5-B6,B5),0)

13

50-75%

=IF(B4>0,IF(B5>0,B4-B5,B4),0)

14

Top 25%

=IF(B3>0,IF(B4>0,B3-B4,B3),0)

15

Blank

=IF(B3<0,B3,0)

16

Top 25%

=IF(B4<0,IF(B3<0,B4-B3,B4),0)

17

50-75%

=IF(B5<0,IF(B4<0,B5-B4,B5),0)

18

25-50%

=IF(B6<0,IF(B5<0,B6-B5,B6),0)

19

Bottom 25%

=IF(B7<0,IF(B6<0,B7-B6,B7),0)

The hard part is done, now let's make our chart. Select the range A9:G19, and start the Chart Wizard. Create a stacked column chart, and make sure Excel plots its series in rows. Here's how the chart looks after I've changed only a small amount of the formatting.

I cleaned up the plot area and gridlines, then I formatted the series one by one. In a case like this, where multiple series share the same formatting, you can format one the way you like, then select another, and press the F4 key to repeat the previous action. In some cases you may have difficulty selecting a series to format it. You can select a different series and use the up and down arrow keys until you get to the right one. Or if you just want to format the series, you can select the corresponding legend key (the little colored square next to the legend text). Click once on the legend, then again on the legend key. The F4 key works here too. I've left the border on the blank series to illustrate how it works.

Well, that's not bad, but there's still more work. I removed the borders around all the columns in the chart, which I should have done in the previous step. Then I removed all the extraneous legend entries. Click once on the legend, then again on the text of the legend. You could format the text of the individual legend entry here if you wanted, but we're going to press Delete to remove the extras. Don't select the legend key (the colored box), because pressing Delete would remove the series from the chart.

This technique can be used to correct a Waterfall Chart that Crosses the X Axis.

 

Peltier Tech Charts for Excel 3.0


Peltier Technical Services, Inc.

Excel Chart Add-Ins | Training | Charts and Tutorials | PTS Blog

Peltier Technical Services, Inc., Copyright © 2017. All rights reserved.
You may link to this article or portions of it on your site, but copying is prohibited without permission of Peltier Technical Services.

Microsoft Most Valuable Professional

Microsoft Most Valuable Professional

My MVP Profile