Tuesday, July 24, 2007

Adding lines on a stacked column chart

Today I had a need to do a graph in Excel where it need to display a stacked column chart and also a line in the same graph.

The data for this is as follows for three years

2008 2009 2010
12000 14000 16000
1000 1000 1000
170000 180000 200000

I wanted a stacked column with the first two rows and a line with the last row. But when I chose the normal 2d column chart, it was showing all three rows as one stacked column.

To get the desired results, I followed the following steps

First, include all three rows in the series part of the chart data and choose the 2d stacked column chart

Next, right-click on the colored part of the bar that corresponds to the year and choose "Chart Type". Then select the first Line graph. Click Ok

Finally, right click on the graph and choose chart options and tick the 'Value Y Axis' tick box under the secondary axis lable of the 'Axes' tab

You should now have the first two rows displayed as a stacked column chart and the third row displayed as a line graph above your columns.

2 comments:

Uzaimi Musa said...

Thank you for your tip. I ma able to construct the grap 2 stacked column and 1 line with two axis.

Anonymous said...

Thanks a lot....this is great and really helpful.

INSERT EXEC failed because the stored procedure altered the schema of the target table.

This morning I was trying to call a stored procedure and insert the results in a temp table using the following code  -- create table #...