There is a very slick way to plot linear and other equations using defined names. The initial setup is a bit tricky, but the end result is flexible and powerful.

Begin by creating a Scatter with Smooth Lines chart using a few dummy numbers in the worksheet, something as simple as the number 1 in A1, 2 in A2, 3 in B1, and 4 in B2.

Create two defined names for the x and y variables by using the `Name Manager`

in the `Formulas`

tab of the ribbon. For the name "x" (for example), in the "Refers to" input box of the name manager create a set of array constants by entering the formula "={1,2,3,4}" (enter the curly brackets, but not the double-quotes). Do the same for the name "y". (The array constants are dummy amounts that will later be replaced by formulas.

Change the series in the chart to refer to the defined names for the equation. Probably the easiest way to do this is to select the line in the chart and then replace the range references in the series equation in the formula bar with the names. Include a reference to the workbook and the sheet in the form shown below when you enter the names; otherwise, Excel won't accept your entry.

Before: =SERIES(,Sheet1!$A$1:$B$1,Sheet1!$A$2:$B$2,1)
You Enter: =SERIES(,[book1]Sheet1!x,[book1]Sheet1]!y,1)
After: =SERIES(,book1!x,book1!y)

At this point, your sheet might look something like the following, with the initial data you used to create the chart and the basic inputs. (The initial data for the chart are now unused and can be deleted.)

The next step is to redefine the names x and y in the name manager. The idea is to replace the ranges that the names initially pointed to with expressions that will produce the set of x values you defined on the sheet and the y values that result from the application of the equation to those x values.

Go back into the name manager to edit the x and y names.

For the x name, replace the array constants ("={1,2,3,4}") with the formula below. The combination of the ROW and OFFSET functions creates the array {1, 2 ... 20} (for this example), which is then shifted to start at -1 and multiplied by the increment by which each x value increases. The end result is an array of 20 equally spaced points starting at -1 and ending at 1.

```
=Sheet1!$B$5+(ROW(OFFSET(Sheet1!$B$1,0,0,Sheet1!$B$7,1))-1)*(Sheet1!$B$6-Sheet1!$B$5)/(Sheet1!$B$7-1)
```

This is an array formula, but no special method is needed to enter it. Excel treats as an array formula any expression entered for a defined name.

For the y name, replace the array constants with the formula

```
=EVALUATE($B$4)
```

With the completion of these steps, the graph is ready for any final formatting you need.

Here is another example chart, where the only change was the equation for y entered into the sheet.

See this link for a more detailed explanation of this technique. A workbook with an example chart can be found here.