# How to Create an X Y Graph in Excel (Step by Step)

To learn how to create an X Y graph in Excel, you select two columns of paired numbers, insert a scatter chart, and label both axes. Excel calls this chart type a scatter chart, and unlike line and column charts it treats the horizontal axis as a true numeric scale. This guide walks through the exact clicks, a worked dataset, and how to add a trendline.

## Quick Answer

- Put your X values in one column and your Y values in the next column, with headers in the row above [1].
- Select the range that includes both columns and the header row, then go to Insert > Charts > Scatter and choose Scatter with only Markers.
- Use Chart Elements (the + button on the chart) to add Axis Titles, then type a name for each axis.
- Add a trendline from the same Chart Elements menu, choose Linear, and check Display Equation on chart [2].
- If the chart plots the wrong column on the horizontal axis, right-click the chart, choose Select Data, click Edit, and exchange the ranges in the Series X values and Series Y values boxes.

## Before You Start

An XY graph needs paired numbers. Each row is one observation with an X value and a Y value that belong together. Excel plots the X value on the horizontal axis and the Y value on the vertical axis [1].

The data layout matters. Microsoft's guidance for scatter charts is to place your X values in the first column and your Y values in the next column [1]. If you reverse them, the chart still draws, but the axes carry the wrong meaning.

A scatter chart differs from a line chart in one important way. A line chart can use text labels or dates along the horizontal axis, and it spaces them evenly [4]. A scatter chart uses the actual numeric values on both axes, so the distance between points reflects the real gap between numbers. That is why a scatter chart is the right choice when you want to show a relationship between two measured quantities.

You do not need any add-ins or special settings. Scatter charts are built into every current desktop version of Excel, including Microsoft 365, Excel 2024, Excel 2021, Excel 2019, and Excel 2016 [1].

## Step by Step

1. Enter your data. Put a header in the first cell of each column, X values below the first header, and Y values below the second header. Keep the two columns side by side with no blank column between them.

2. Select the data range. Drag from the top-left header cell to the bottom-right value cell so the selection forms a rectangle. If your data is in a continuous range, you can also click any single cell inside it and Excel will include the whole range [1].

3. Insert the chart. Go to the Insert tab, open the Charts group, select Scatter, and choose Scatter with only Markers. This option draws points without connecting lines, which is what you want for raw measurements.

4. Add axis titles. Click the chart to select it, then click the Chart Elements button (the plus sign at the top-right of the chart) and check Axis Titles. Type a descriptive name for the horizontal axis and the vertical axis.

5. Add a trendline. With the chart still selected, open Chart Elements again, check Trendline, and pick the type you want, such as Linear, Exponential, Linear Forecast, or Moving Average [2]. For a straight-line fit, choose Linear.

6. Show the equation. In the trendline options, check Display Equation on chart. Excel writes the fitted line as $y = mx + b$ directly on the plot so readers can see the slope and intercept.

7. Check the axis assignment. A scatter chart uses the first column of the selection as the X values. If the columns landed on the wrong axes, right-click the chart, choose Select Data, click Edit, and exchange the ranges in the Series X values and Series Y values boxes.

## Worked Example

The dataset below holds 10 paired measurements. Column B is the X value and column C is the Y value, and each row is one measurement labeled in column A.

| | A | B | C |
|---|---|---|---|
| 1 | Measurement | X Value | Y Value |
| 2 | M1 | 1 | 2.1 |
| 3 | M2 | 2 | 3.9 |
| 4 | M3 | 3 | 6.2 |
| 5 | M4 | 4 | 7.8 |
| 6 | M5 | 5 | 10.1 |
| 7 | M6 | 6 | 12.3 |
| 8 | M7 | 7 | 13.9 |
| 9 | M8 | 8 | 16.2 |
| 10 | M9 | 9 | 18.1 |
| 11 | M10 | 10 | 20 |

The values in B2:C11 are typed constants, so there are no formulas to evaluate in this sheet. The chart is built entirely from those numbers.

To reproduce the figure, follow these interface steps:

1. Select the range B1:C11 (X and Y values including headers).
2. Go to Insert > Charts > Scatter, then choose Scatter with only Markers.
3. Click the chart, then use Chart Elements (+) to check Axis Titles.
4. Set the horizontal axis title to "X Value" and the vertical axis title to "Y Value".
5. In Chart Elements, check Trendline, then choose Linear and check Display Equation on chart.

The result is an XY scatter chart of 10 paired measurements with labeled axes and a linear trendline. Because the Y values rise steadily as X increases, the points fall close to a straight line, and the linear trendline summarizes that pattern with a slope near 2 and an intercept near 0.

If you want to check the fit numerically, the slope of a least-squares line through paired data is

$$m = \frac{n\sum x_i y_i - \sum x_i \sum y_i}{n\sum x_i^2 - \left(\sum x_i\right)^2}$$

and the intercept is $b = \bar{y} - m\bar{x}$. Excel computes both for you when you add the trendline, so you only need the formula if you want to verify the displayed equation.

## Other Ways to Do It

You can create a chart in one keystroke. Select the data and press ALT + F1 to insert a chart immediately, though Excel may pick a chart type that does not suit paired numeric data [2]. If the default is wrong, change the chart type afterward.

The Recommended Charts route is another option. Select your data, go to Insert > Charts > Recommended Charts, and preview the suggestions on the Recommended Charts tab. If none of them is a scatter chart, open the All Charts tab to see every chart type [2].

If you would rather not build the chart by hand, the [Scatter Plot Maker](/tools/scatter-plot-maker) produces the same kind of plot from pasted X and Y values.

For a broader tour of chart types, see [how to make a chart in Excel](/blog/data-analysis/how-to-make-chart-in-excel). If your horizontal axis holds dates or categories instead of numbers, a [line chart](/blog/data-analysis/how-to-make-line-chart-excel) is usually the better fit [4]. When you want to compare categories rather than two numeric variables, use a [bar chart](/blog/data-analysis/how-to-make-bar-chart-excel). And if you need to swap which variable sits on which axis after the fact, the steps are in [flip the X and Y axis in Excel](/blog/data-analysis/flip-x-y-axis-excel).

## Troubleshooting

**The chart shows one line instead of scattered points.** You probably inserted a line chart. Delete it and insert a scatter chart from the Scatter menu instead.

**The X values appear on the vertical axis.** A scatter chart takes its X values from the first column of the selection. To correct it, right-click the chart, choose Select Data, click Edit, and exchange the ranges in the Series X values and Series Y values boxes.

**Only one series appears when you expected two.** Check that your selection forms a rectangle. Nonadjacent cells and ranges can be selected, but the overall selection must be rectangular [1].

**A new column of data is missing from the chart.** If the chart sits on the same worksheet as the source data, enter the new values next to or below the existing data and drag the sizing handles around the source range to include them. The chart updates automatically [5]. If the chart is on a separate chart sheet, add the series through the Select Data dialog box instead [5].

**The trendline equation covers the data.** Drag the equation text box to an empty corner of the plot area, or turn off Display Equation on chart and read the slope from the Format Trendline pane.

## Common Mistakes

- **Plotting X and Y in the wrong order.** Excel expects X values in the first column and Y values in the next column [1]. Fix it by swapping the columns or by editing the series in the Select Data dialog box.
- **Leaving the header row out of the selection.** Without headers, Excel names the series "Series1" and the legend becomes useless. Include row 1 in the selection.
- **Choosing a line chart for numeric pairs.** A line chart spaces horizontal labels evenly and can use text labels, so it hides the true spacing of your X values [4]. Use a scatter chart when both variables are numbers.
- **Adding a trendline that does not match the shape of the data.** A linear fit on a curved relationship draws a line that misses the pattern. Try Exponential or Moving Average instead [2].
- **Forgetting axis titles.** A chart with unlabeled axes forces readers to guess what the numbers mean. Add titles through Chart Elements.

## Limitations

A scatter chart shows association, not causation. A tight trendline means the two variables move together in your sample, and it says nothing about which one drives the other or whether a third variable explains both.

Excel's trendline options are also limited in scope. You can fit Linear, Exponential, Linear Forecast, or Moving Average lines from the Chart Elements menu [2], but the equation Excel displays is rounded, so it may not reproduce the plotted line to many decimal places. For inference, confidence intervals, or model diagnostics, move the data into a statistics package. The chart is a visual summary, not a substitute for a proper regression analysis.

## Frequently Asked Questions

### What is the difference between an XY graph and a line chart in Excel?

An XY scatter chart plots both variables on numeric scales, so the horizontal position of each point reflects its actual X value. A line chart can use text labels or dates on the horizontal axis and spaces them evenly, which suits time series but distorts the spacing of numeric pairs [4].

### How do I add axis labels to an XY graph in Excel?

Click the chart, click the Chart Elements button (the plus sign), and check Axis Titles. Two text boxes appear, one under the horizontal axis and one beside the vertical axis. Click each box and type your label.

### How do I add a trendline and show its equation?

Open Chart Elements, check Trendline, and choose the type, such as Linear or Exponential [2]. Then open the trendline options and check Display Equation on chart. Excel writes the fitted equation on the plot area.

### Why does my scatter chart put the wrong column on the X axis?

A scatter chart uses the first column of your selection as the X values and the next column as the Y values. To swap them, right-click the chart, choose Select Data, click Edit, and exchange the ranges in the Series X values and Series Y values boxes.

### Can I add a second data series to an existing XY chart?

Yes. If the chart is on the same worksheet as the source data, enter the new values next to or below the existing data and drag the sizing handles to cover the new range. The chart updates automatically [5]. If the chart is on its own chart sheet, use the Select Data dialog box instead [5].

## References

1. [Select data for a chart | Microsoft Support](https://support.microsoft.com/en-us/excel/select-data-for-a-chart)
2. [Create a chart from start to finish | Microsoft Support](https://support.microsoft.com/en-us/excel/get-started/create-a-chart-from-start-to-finish)
3. [Change how rows and columns of data are plotted in a chart | Microsoft Support](https://support.microsoft.com/en-us/excel/change-how-rows-and-columns-of-data-are-plotted-in-a-chart)
4. [Present your data in a scatter chart or a line chart | Microsoft Support](https://support.microsoft.com/en-us/excel/present-your-data-in-a-scatter-chart-or-a-line-chart)
5. [Add a data series to your chart | Microsoft Support](https://support.microsoft.com/en-us/office/add-a-data-series-to-your-chart)

## Further Reading

- [Broman KW, Woo KH (2018). Data Organization in Spreadsheets. The American Statistician](https://doi.org/10.1080/00031305.2017.1375989)
- [Ziemann M, Eren Y, El-Osta A (2016). Gene name errors are widespread in the scientific literature. Genome Biology](https://doi.org/10.1186/s13059-016-1044-7)

## Related Articles

- [How to Make a Chart in Excel (Step by Step)](/blog/data-analysis/how-to-make-chart-in-excel)
- [How to Make a Line Chart in Excel (Step by Step)](/blog/data-analysis/how-to-make-line-chart-excel)
- [How to Make a Bar Chart in Excel (Step by Step)](/blog/data-analysis/how-to-make-bar-chart-excel)
- [How to Flip the X and Y Axis in Excel (Step by Step)](/blog/data-analysis/flip-x-y-axis-excel)
- [How to Make a Formula in Excel (Step by Step)](/blog/data-analysis/how-to-make-formula-in-excel)