Infinite opportunities?  Endless problems?  Limited resources?  Talk to us!
Operations
Consulting
Software
Consulting
Publishing and
Training
Applied
Solutions
Excel add-ins
and tutorials
Charts Excel and VBA
Case Studies
VBA
tutorials
PowerPoint
Add-Ins
Miscellenia
You are on the Home/Excel/Charts/Straight lines page
About this site

What's new

Google
Web
This Site
 

 

Adding a horizontal line to a chart
There are many instances when one needs to add a visual indicator to a chart.  This could be a line indicating a goal of some sort.  Or, it could be a line showing the average of the graphed data.  In TQM control charts, it could be a line so-many standard deviations from the mean.

One way draw such a line would be to calculate the values in cells in a worksheet, and plot these cells on the chart.  Another way is to use a named formula, which means that the charted threshold values do not show up on the worksheet.  This tutorial shows how to use a named formula.

 

The example uses the data set on the right.  Of course, you will use your own data.

 

First, create the chart from the data set.  The example uses a XY Scatter chart.
Next, define two names.  The first, aRng, is just for convenience.  The second, meanLine, is the one that generates as many numbers as in the original data, each equal to the average.  How?

How does the meanLine named formula work?
(a) OFFSET(aRng, 0,1) selects the 2nd column of data, i.e., the y-values.
(b) AVERAGE(...) gives the average of y-values.
(c) ROW(aRng)/ROW(aRng) creates an array of ones.  The array has as many data points as in the original data.
Multiplying (b) by (d) replaces the ones in the array by the average value. 

Next, add a new series to the chart, using this newly defined name.  How?
Format the new series to hide the markers and show the line.

The job is done!

 

 

For custom technology solutions, operations consulting, or training contact web-underscore-contact@tushar-hyphen-mehta-dot-cee-oh-em.
By accessing any page or link on this web site other than this page, you agree to the terms and conditions.

Ads from amazon.com

[Optional] Survey (current rating of site: 3.7 out of 4)  If you will take a moment to provide your comments, it will help improve the site both for you, and for other visitors.

On a scale of 4 (just what I need)
to zero (totally useless)

How do you rate the information

on this page?

  on this site?

[Optional]

Your name
Your email address
Other comments
 
Monitor page
for changes
  
it's private   

by ChangeDetection
A comment selected at random:

 

Copyright © 2000-2008 Tushar Mehta.
Send comments and suggestions about the web site to webmaster@tushar-hyphen-mehta-dot-cee-oh-em
Last edited April 14, 2008