How To Add A Line in Excel Graph
How To Add A Line in Excel Graph
)
How to draw an average line in Excel graph
This quick example will teach you how to add an average line to a column graph. To have it done, perform these 4 simple steps:
Calculate the average by using the AVERAGE function.
In our case, insert the below formula in C2 and copy it down the column:
=AVERAGE($B$2:$B$7)
Page 1 of 13
Switch to the All Charts tab, select the Clustered Column - Line template, and click OK:
Done! A horizontal line is plotted in the graph and you can now see what the average value looks like relative to your data set:
Page 2 of 13
In a similar fashion, you can draw an average line in a line graph. The steps are totally the same, you just choose the Line or Line with Markers type for the Actual data
series:
Tips:
The same technique can be used to plot a median For this, use the MEDIAN function instead of AVERAGE.
Adding a target line or benchmark line in your graph is even simpler. Instead of a formula, enter your target values in the last column and insert the Clustered Column -
Line combo chart as shown in this example.
If none of the predefined combo charts suits your needs, select the Custom Combination type (the last template with the pen icon), and choose the desired type for
each data series.
Page 3 of 13
Right-click the existing graph, and choose Select Data… from the context menu:
In the Select Data Source dialog box, click the Add button in the Legend Entries (Series)
Page 4 of 13
The target line series is added to the graph (orange bars in the screenshot below). Right-click it, and choose Change Series Chart Type… in the context menu:
In the Change Chart Type dialog box, make sure Combo > Custom Combination template is selected, which should be by default. For the Target line series, pick Linefrom
the Chart Type drop-down box, and click OK.
Page 5 of 13
Done! A horizontal target line is added to your graph:
Page 6 of 13
To visualize the target values more clearly, you can display them in this way:
To achieve this effect, add a line to your chart as explained in the previous examples, and then do the following customizations:
In your graph, double-click the target line. This will select the line and open the Format Data Series pane on the right side of your Excel window.
On the Format Data Series pane, go to Fill & Line tab > Line section, and select No line.
Switch to the Marker section, expand Marker Options, change it to Built-in, select the horizontal bar in the Type box, and set the Size corresponding to the width of
your bars (24 in our example):
Set the marker Fill to Solid fill or Pattern fill and select the color of your choosing.
Set the marker Border to Solid line and also choose the desired color.
Page 7 of 13
The screenshot below shows my settings:
Page 8 of 13
Click on the line to select it:
With the whole line selected, click on the last data point. This will unselect all other data points so that only the last one remains selected:
Right-click the selected data point and pick Add Data Label in the context menu:
Page 9 of 13
The label will appear at the end of the line giving more information to your chart viewers:
Hover over the label box until your mouse pointer changes to a four-sided arrow, and then drag the label slightly above the line:
Page 10 of 13
Right-click the label and choose Font… from the context menu.
When finished, remove the chart legend because it is now superfluous, and enjoy a nicer and clearer look of your chart:
Page 11 of 13
Change the line type
If the solid line added by default does not look quite attractive to you, you can easily change the line type. Here's how:
Double-click the line.
On the Format Data Series pane, go Fill & Line > Line, open the Dash type drop-down box and select the desired type.
For example, you can choose Square Dot:
Page 12 of 13
Here is a quick solution: double-click the on the horizontal axis to open the Format Axis pane, switch to Axis Options and choose to position the axis On tick marks:
However, this simple method has one drawback - it makes the leftmost and rightmost bars half as thin as the other bars, which does not look nice.
As a workaround, you can fiddle with your source data instead of fiddling with the graph settings:
Insert a new row before the first and after the last row with your data.
Copy the average/benchmark/target value in the new rows and leave the cells in the first two columns empty, as shown in the screenshot below.
Select the whole table with the empty cells and insert a Column - Line chart.
Now, our graph clearly shows how far the first and last bars are from the average:
Tip.
Page 13 of 13