To graph two numerical variables in Excel, put each variable in its own column, select the paired data, then choose Insert > Insert Scatter (X, Y) or Bubble Chart > Scatter. An XY scatter chart places one variable on the horizontal axis and the other on the vertical axis, so you can see how their values relate. You can then add a clear title, axis labels, and an optional trendline.
The steps below are for Microsoft Excel for Microsoft 365 on Windows. They work well for questions such as whether study hours are associated with test scores, or whether temperature changes with electricity use. A graph can show a pattern, but it does not by itself prove that one variable causes the other.
What You’ll Need
- An Excel workbook containing two variables measured for the same observations.
- A header for each variable and one row per paired observation.
- Numeric values for both variables if you want a true XY scatter chart.
For example, enter Study hours in A1 and Test score in B1. Put one person’s study hours in A2 and that same person’s score in B2, then continue with one person per row. Keeping paired values on the same row is essential: Excel treats each row as one plotted point.
Step-by-Step
- Arrange the two variables in adjacent columns. Put the variable you want along the bottom of the graph in the first column; this is the X variable. Put the variable you want to compare against it in the next column; this is the Y variable. Use a descriptive header in the top row of each column. For instance, list Study hours in column A and Test score in column B. The two values in any one row must describe the same observation. If your data has a row for each month, put that month’s value for both variables in that row.
- Check that the values are usable. The data rows should contain numbers, not explanatory notes or units typed into the same cells. Keep units in the header, such as Distance (km), rather than entering 5 km in a value cell. Remove empty rows inside the data, check for accidental text entries, and make sure no column has been sorted without the other. If a value is missing, leave the cell blank rather than shifting the following observations up by one row.
- Select the two columns, including their headers. Drag across the complete data range, for example A1:B21 if the headers are in row 1 and there are 20 observations. Including the headers helps Excel identify the series name. If the columns are not adjacent, select the first range, then hold Ctrl on Windows while selecting the second range. Separate selections can be harder for Excel to interpret; if the resulting chart is wrong, arrange the variables side by side or set the series ranges manually in a later step.
- Insert an XY scatter chart. Open the Insert tab on the ribbon. Choose Insert Scatter (X, Y) or Bubble Chart, then select the basic Scatter option, usually shown with markers and no connecting lines. Excel inserts a chart in the worksheet. The first selected column should supply the horizontal X values, and the second should supply the vertical Y values. For most comparisons of two measured quantities, this basic scatter chart is the right starting point.
- Confirm that Excel assigned the axes correctly. Look at the chart and compare a few plotted points with the source rows. The horizontal scale should match the first variable, and the vertical scale should match the second. If Excel has treated a header as a value, put the correct header in the first row and check that values are numeric. If the axes are reversed, use Chart Design > Select Data. Select the series and choose Edit, then set Series X values to the first variable’s data cells and Series Y values to the second variable’s data cells. Do not include the header cells in those value ranges.
- Add a specific chart title. Click the chart, open Chart Design > Add Chart Element > Chart Title, and choose Above Chart. Click the title box and replace the generic text with a description that says what is being compared. For example, Study Hours and Test Scores is more informative than Chart Title. If the graph will appear in a report, include enough context to make it understandable without relying on nearby text.
- Label both axes with names and units. With the chart selected, choose Chart Design > Add Chart Element > Axis Titles > Primary Horizontal, then repeat for Primary Vertical. Click each axis title and enter the corresponding variable and unit, such as Study hours per week and Test score (points). Make sure the horizontal title names the X variable and the vertical title names the Y variable. Units help readers understand what a change in one step on the scale means.
- Adjust the chart size and placement. Drag a corner handle to resize the chart while keeping its proportions, or drag the chart’s edge to move it. Give the axis labels enough room to display fully. If the graph is intended for printing, use a size that remains readable on the page and check it in Print Preview. Avoid shrinking the chart so much that markers, scale numbers, or labels become difficult to distinguish.
- Choose a useful marker or line style. For separate observations, markers without connecting lines are usually clearest. To change the appearance, right-click a marker and choose Format Data Series; use the formatting pane to adjust marker options or line settings. A scatter chart with straight or smooth lines is available from the same scatter-chart menu, but use connecting lines only when the order of observations matters, such as measurements taken over time. Connecting unrelated observations can imply a sequence that is not present in the data.
- Add a trendline only if it helps explain the pattern. Select a data point, then choose Chart Design > Add Chart Element > Trendline and select a suitable option, such as Linear. A linear trendline summarizes a roughly straight relationship; it is not appropriate for every data pattern. You can right-click the trendline and choose Format Trendline to display an equation or R-squared value, if useful. Explain these statistics in context rather than treating them as proof of cause and effect.
You can now compare the two variables visually. A scatter chart with a clear title and labeled axes is usually more useful than a chart that only looks polished: the labels tell readers what each position means, while the points reveal the distribution and any possible relationship.
Common Mistakes
- Choosing a line chart for two measured quantities. A line chart commonly treats its horizontal entries as categories spaced evenly apart. If X values are numbers such as 2, 5, and 20, that spacing can be misleading. Use an XY scatter chart when the horizontal values are numeric measurements and their actual spacing matters.
- Pairing the wrong rows. A point is meaningful only when its X and Y values belong to the same observation. Sorting one column alone, or deleting a cell without its matching value, can create false relationships. Sort the whole table together and keep every observation on one row.
- Including text or totals as observations. Notes, unit labels, blank rows, and summary totals mixed into the data range may confuse the chart or add points that do not represent individual observations. Keep headers at the top and actual paired measurements in the data rows.
- Making a chart without axis titles. A reader may see a pattern but not know whether the values represent minutes, dollars, or another unit. Give both axes meaningful labels, and include units when they apply.
- Assuming a visible trend proves causation. Two variables can move together for many reasons, including coincidence or a third factor. Describe the chart as showing an association or pattern unless the study design supports a causal conclusion.
Tips
- Put the explanatory or independent variable on X. This is often time, distance, dose, or another quantity used to organize the comparison. Put the measured response on Y. This convention makes the graph easier to interpret, although you can choose another orientation when the question calls for it.
- Use a modest number of colors. A single series usually needs only one marker color. If you have distinct groups, such as product types, create separate series and use a legend; do not assign a different color to every point unless the colors encode useful information.
- Keep scales honest and legible. Excel chooses axis bounds automatically. If you need to change them, right-click an axis, choose Format Axis, and adjust Bounds or Units in the pane. A nonzero minimum can make small differences look dramatic, so use it only when appropriate and make the scale clear.
- Use a table for data that will grow. Select the range and choose Insert > Table. A chart based on a table can include new rows as the table expands, depending on the chart’s source range. This can save you from rebuilding the graph after adding observations.
- Keep the raw data intact. Make a copy of the sheet before extensive editing, and leave the original values available for checking. If the graph looks surprising, compare individual chart points with their source rows before drawing conclusions.
Troubleshooting
The chart is blank or shows only one point: Check that the selected cells contain numeric values and that the X and Y ranges have the same number of data rows. Values that look like numbers but are stored as text may not plot as expected. Select the affected cells and convert them to numbers, then check that the chart source includes the full range.
The chart shows a strange series name or extra point: Open Chart Design > Select Data and review the series name and X and Y ranges. Remove header or total cells from the value ranges, and make sure the series name refers to the header cell rather than an observation. If needed, edit the series and select the data cells again.
The chart has the wrong variable on an axis: Go to Chart Design > Select Data, select the series, and choose Edit. Set the X values to the cells for the intended horizontal variable and the Y values to the corresponding vertical variable. Confirm that both ranges start and end on the same rows.
The axis labels or title are missing: Select the chart and use Chart Design > Add Chart Element to add a chart title or primary axis titles. If the title boxes are present but not visible, resize the chart or reduce the title length. On Excel for Mac, the ribbon also has chart design controls when a chart is selected; depending on the window layout, chart elements may be available from the Chart Design tab or chart formatting controls. In Excel for the web, select the chart and use the Chart or Chart Design options available in the ribbon; some advanced formatting controls can differ from the desktop app.
The chart looks cluttered or points overlap: Increase the chart’s size, reduce marker size in Format Data Series, or use transparency if many observations overlap. You can also inspect the underlying data for repeated values. Do not remove legitimate observations just to make the chart look simpler; choose a clearer scale or explain the overlap instead.
Frequently Asked Questions
What type of Excel graph is best for two variables?
Use an XY scatter chart when both variables are numeric and you want their actual values shown on the horizontal and vertical axes. A line chart can be useful for data across ordered categories, especially dates, but it does not handle numeric X spacing in the same way as a scatter chart.
Can one variable be text or a category?
A basic XY scatter chart expects numeric X and Y values. For categories such as departments or product names, a column or bar chart is often clearer. If one variable is a category and the other is numeric, put categories in one column and measurements in another, select the range, and use Insert > Insert Column or Bar Chart.
How do I show more than one pair of variables?
To compare several groups that share the same X and Y definitions, add each group as a separate series. Use Chart Design > Select Data > Add, then provide a series name and its matching X and Y ranges. Give each series a clear legend entry. If the extra data represents a different Y variable with different units, consider making a separate chart rather than combining incompatible scales.
Can I connect the points?
Yes. Select the chart and choose Chart Design > Change Chart Type, then select an XY scatter subtype with straight lines or smooth lines. Connecting points is useful when their order has meaning, such as a sequence of dates. For independent observations, markers without lines usually avoid suggesting a sequence that does not exist.
How do I add a trendline in Excel?
Select the plotted series and choose Chart Design > Add Chart Element > Trendline, then choose a model such as Linear. A trendline can summarize a pattern, but check whether its shape fits the data and explain it carefully. A trendline does not establish that changes in one variable cause changes in the other.
Will the graph update when I change the data?
Charts linked to worksheet cells update when those source values change. If you add new rows outside the original source range, the chart may not include them automatically. Use an Excel table for an expanding dataset or update the chart’s source range through Chart Design > Select Data.