# Microsoft Office Application Help - Excel Help forum > Excel Charting & Pivots >  >  Plotting straight line using a single value

## cogar

Hello,

Please refer to the attached chart.

How do I stretch the PINK line so that it can plot the value contained in cell D2 over the entire period.

What I am trying to do is what a guy was asking in the forum. However, the solution posted could not work.

Thanks much.


*The question and solution from excel forum*

Constant horizontal line on a chart (based on a single value)

Posted by Skewer on July 18, 2001 11:22 AM

Image the scene, you want a graph showing stuff but there is an ideal value or range of values (as in cost, weight, etc). 

How can I get a single value (already calculated elsewhere) or values to generate horizontal lines so at a glance the approach towards (or fluctuation between) certain values is visible? 

I could just draw an autoshape over the graph I guess but then how could I get that to move around?! Surely there's a chart method that doesn't involve a hidden row(s) containing solely absolute references to this value in its calculated location? 

Cheers,
SQR



Re: Constant horizontal line on a chart (based on a single value)

Posted by Mark W. on July 18, 2001 11:55 AM

Let's assume that your desired Y-intercept value 
is in cell Sheet1!$A$1. First, create a defined 
name called Sheet1!Y_Intercept_Value with a 
reference of ={1,1}*Sheet1!$A$1. Select your 
chart area and on the formula bar enter the formula, 
=SERIES(,,Sheet1!Y_Intercept_Value,1). Y=A1 should 
now be plotted on your chart!

----------


## cogar

Hello,

Please refer to the attached chart (Excel 2003).

How do I stretch the PINK line so that it can plot the value contained in cell D2 over the entire period.

What I am trying to do is what a guy was asking in the forum. However, the solution posted could not work.

Thanks much.


The question and solution from excel forum

Constant horizontal line on a chart (based on a single value)

Posted by Skewer on July 18, 2001 11:22 AM

Image the scene, you want a graph showing stuff but there is an ideal value or range of values (as in cost, weight, etc).

How can I get a single value (already calculated elsewhere) or values to generate horizontal lines so at a glance the approach towards (or fluctuation between) certain values is visible?

I could just draw an autoshape over the graph I guess but then how could I get that to move around?! Surely there's a chart method that doesn't involve a hidden row(s) containing solely absolute references to this value in its calculated location?

Cheers,
SQR



Re: Constant horizontal line on a chart (based on a single value)

Posted by Mark W. on July 18, 2001 11:55 AM

Let's assume that your desired Y-intercept value
is in cell Sheet1!$A$1. First, create a defined
name called Sheet1!Y_Intercept_Value with a
reference of ={1,1}*Sheet1!$A$1. Select your
chart area and on the formula bar enter the formula,
=SERIES(,,Sheet1!Y_Intercept_Value,1). Y=A1 should
now be plotted on your chart!

----------


## shg

You need two points to plot a line:

x1  y1
x2  y2

If the line is horizontal, then x1 is the minimum x value for the plot, x2 is the max, and y1=y2.

----------


## cogar

Thank you SHG.

Could you show me how to do it using the spreadsheet I have attached in this thread.


Also, how come the solution posted by below does not work?

_Re: Constant horizontal line on a chart (based on a single value)

Posted by Mark W. on July 18, 2001 11:55 AM

Let's assume that your desired Y-intercept value
is in cell Sheet1!$A$1. First, create a defined
name called Sheet1!Y_Intercept_Value with a
reference of ={1,1}*Sheet1!$A$1. Select your
chart area and on the formula bar enter the formula,
=SERIES(,,Sheet1!Y_Intercept_Value,1). Y=A1 should
now be plotted on your chart!_

----------


## cogar

Hello,

Please refer to the attached chart.

How do I stretch the PINK line so that it can plot the value contained in cell D2 over the entire period.

What I am trying to do is what a guy was asking in the forum. However, the solution posted could not work.

Thanks much.


The question and solution from excel forum
Constant horizontal line on a chart (based on a single value)

Posted by Skewer on July 18, 2001 11:22 AM

Image the scene, you want a graph showing stuff but there is an ideal value or range of values (as in cost, weight, etc).

How can I get a single value (already calculated elsewhere) or values to generate horizontal lines so at a glance the approach towards (or fluctuation between) certain values is visible?

I could just draw an autoshape over the graph I guess but then how could I get that to move around?! Surely there's a chart method that doesn't involve a hidden row(s) containing solely absolute references to this value in its calculated location?

Cheers,
SQR



Re: Constant horizontal line on a chart (based on a single value)

Posted by Mark W. on July 18, 2001 11:55 AM

Let's assume that your desired Y-intercept value
is in cell Sheet1!$A$1. First, create a defined
name called Sheet1!Y_Intercept_Value with a
reference of ={1,1}*Sheet1!$A$1. Select your
chart area and on the formula bar enter the formula,
=SERIES(,,Sheet1!Y_Intercept_Value,1). Y=A1 should
now be plotted on your chart!

----------


## shg

I changed the chart to a scatter plot, and added this series:



```
Please Login or Register  to view this content.
```


There may be a way to do it with a line chart as you are trying to do -- don't know.

You could just add a column of twos (or references to D2) and plot that as a second series on your line chart.

----------


## oldchippy

Hi,

Does this link offer any help?

http://peltiertech.com/Excel/Charts/...orzSeries.html

----------


## cogar

Hello,

Thank you oldchippy and SHG.

The method described in the link does not work for me because it uses the secondary axis, which I will need to use it for other series.

I still prefer the method in which you can simply use a "named" constant that points to a single value in a cell to draw a line across the entire x-axis.

Thank you.

----------

