Share via

Adding an average line to a bar chart.

Anonymous
2011-09-08T06:45:47+00:00

Let's say I have a bar diagram.

How do I make an average - not a moving (!) average, mind you - show up as a horizontal line across the whole diagram?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2011-09-08T07:23:12+00:00

    Suppose your x-axis labels are in cells A2:A5 and the corresponding values are in cells B2:B5 you would enter the following formula in cell C2 and copy it down:

    =AVERAGE($B$2:$B$5)

    Now highlight all your data and insert a column chart, your average series will appear as a set of columns.  Click on the Average series and use the Change Chart Type button to change it to a line.

    1 person found this answer helpful.
    0 comments No comments

Answer accepted by question author

  1. Anonymous
    2011-09-08T11:54:18+00:00

    You need to set your two series up to have different x-axis values.  Set up the column of average values as described but add an extra row at the top and bottom containing only the average values.  Create your chart as normal so you have a line and column chart then select the Average series, press Ctrl+1 and tick the option to plot on a secondary axis.  Now click the Select Data button and click on the Average series.  If you have 6 average values in your average column, click on the Edit button for the x-axis values and enter

    ={1,2,3,4,5,6}

    in the box.  When you click OK you should now see values 1 to 6 in the x values when the Average series is selected but your other x values when the data series is selected.  Also check the other settings for the series to make sure it is picking up the cell containing Average as the label and the 6 (or however many) average values as the data for the series.  When you have done this, click on the Axes button and select Secondary Left to Right axis, your secondary x-axis will now display.  Select this axis and press Ctrl+1 and set the Position Axis bullet to On Tick Marks, you can also set Axis Labels to None to remove the numbering on the secondary axis.

    0 comments No comments

9 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-09-08T09:01:21+00:00

    It depends what type of x-axis you have, you could add extra category values and enter the average against them to extend the line but you then have the complication of whether you can get the x-axis to display the required range, do you have dates on your x-axis?

    0 comments No comments
  2. Anonymous
    2011-09-08T08:02:58+00:00

    Andrea wrote:

    Suppose your x-axis labels are in cells A2:A5 and the corresponding values are in cells B2:B5 you would enter the following formula in cell C2 and copy it down:

    =AVERAGE($B$2:$B$5)

    Since AVERAGE($B$2:$B$5) is invariant  -- the same wherever you put it -- do yourself a favor and put =AVERAGE($B$2:$B$5) into C2, =C2 into C3 and copy C3 down.

    0 comments No comments
  3. Anonymous
    2011-09-08T07:52:27+00:00

    Thanks a lot. That was the kind of thing I was looking for.

    However, that way will have the "average chart" start in the middle of the first bar and end in the middle of the last bar.

    Is there a way to extend the line to the edges of the chart?

    0 comments No comments