Excel Line Chart: Switch X and Y Axes the Right Way

Charts & pivot tables · Updated November 3, 2026

Excel Line Chart: Switch X and Y Axes the Right Way

In Excel, a line chart’s Switch Row/Column command changes which data series are plotted; it does not literally exchange the horizontal and vertical axes. If you need numeric values on both axes—for example, time on X and distance on Y—change the chart to an XY (Scatter) chart instead.

What Excel’s line-chart axes represent

A standard line chart uses a category axis along the bottom and a value axis up the side. The category axis usually shows labels such as months, product names, or stages. The value axis shows the numbers being measured, such as revenue or temperature. Although people often call the bottom axis the X-axis and the side axis the Y-axis, a line chart does not treat both axes as freely interchangeable numeric scales.

That distinction explains why changing the chart’s row and column arrangement may not produce the result you expect. Excel can plot each row as a separate series instead of each column, but the chart still has categories along the bottom and values on the side. The data orientation changes; the roles of the two axes do not.

For example, if a table lists months down the first column and sales for two stores in the next columns, Excel will usually put the months along the bottom and draw one line per store. Switching rows and columns can instead make each store’s values act as categories and make the months separate series. Whether that is useful depends on the table and the question the chart should answer.

Switch rows and columns in Excel for Windows

To change how Excel groups the selected data in a line chart, select the chart and use the chart ribbon:

  1. Click the line chart to display its chart-specific tabs.
  2. Open Chart Design.
  3. Select Switch Row/Column.
  4. Check the bottom-axis labels, lines, and legend. If the result is not useful, select the command again to return to the previous arrangement.

This is a quick way to correct a chart when Excel guessed the series direction incorrectly. The command does not transpose the worksheet cells, move the axes, or turn category labels into numeric X coordinates. It only changes which rows or columns Excel interprets as separate series.

In Excel for Mac, select the chart and look for Chart Design > Switch Row/Column as well. The ribbon layout can differ slightly between versions, but the command has the same purpose. There is no need to rearrange the source table just to test the alternate series grouping; switching the chart back restores the original interpretation.

Choose the right data orientation

A clear source table makes the switch easier to understand. Put category labels in the first column or row, and use the other dimension for series names. For instance, a table with quarters in A2:A5, Store North in B1, Store South in C1, and their sales figures in B2:C5 naturally supports a chart with four quarter categories and two store lines.

With that layout, Excel typically uses the quarter labels as the horizontal categories and each store column as a series. If the chart instead shows one line per quarter and places store names along the bottom, click Switch Row/Column. The useful arrangement is the one that makes the intended comparison clear—not necessarily the one that matches the physical direction of the data on the sheet.

  • Use one series per product, location, or measurement when comparing those items over time.
  • Use category labels that are short enough to read along the horizontal axis.
  • Keep each series’ observations in a consistent order, especially when categories represent dates or stages.
  • Include headers so Excel can use meaningful names in the legend.

If the data has several header rows, blank columns, or unrelated numbers next to it, Excel may select an unsuitable chart range or infer the series names incorrectly. Select only the intended rectangular data range, including its headers, before inserting the chart. You can adjust it later through Chart Design > Select Data.

When an XY scatter chart is the correct fix

Use an XY scatter chart when each plotted point has a numeric X value and a numeric Y value. Examples include plotting height against weight, elapsed time against speed, or temperature against energy use. A line chart treats its horizontal entries primarily as categories; a scatter chart positions points according to their actual numeric X coordinates. That means the spacing between points can vary in a scatter chart, while category positions on a typical line chart are evenly spaced.

To convert an existing line chart in Excel for Windows, select it and choose Chart Design > Change Chart Type. Select XY (Scatter), choose a scatter subtype, and select OK. A subtype with straight lines can connect points in their X-value order; markers alone are often clearer when the goal is to show a relationship between two measurements.

For a new chart, arrange the data in paired columns: one column for X values and another for Y values. Select the two columns, including suitable headers, then use Insert > Insert Scatter (X, Y) or Bubble Chart and choose a scatter option. For multiple series, each series needs its own X-value range and Y-value range. If Excel assigns the ranges incorrectly, open Chart Design > Select Data, select a series, choose Edit, and set its X and Y ranges separately.

Do not convert to scatter just because you want the chart to show a different set of lines. If the horizontal labels are names or dates and the values are measurements, a line chart may be the right choice; try switching rows and columns or correcting the selected range first. Scatter is specifically useful when the horizontal positions themselves are meaningful numbers.

Fix common axis and chart problems

The chart shows too many lines: Excel may be treating rows as series when columns would make more sense, or the selected range may include extra fields. Try Switch Row/Column, then inspect Chart Design > Select Data to remove unwanted series or correct the chart range.

The horizontal labels appear in the wrong order: First check the order of the source data. If you only want to reverse the display order, right-click the horizontal axis, choose Format Axis, and under Axis Options select Categories in reverse order. Reversing categories changes their display order; it does not exchange the axis roles. Excel may reposition the vertical axis when categories are reversed, so check its crossing position afterward.

Dates look evenly spaced even when gaps differ: A line chart may treat dates as categories, giving each listed date equal space. If proportional spacing by elapsed time matters, use a scatter chart with real date values as the X coordinates. Check that the source cells contain actual Excel dates rather than text that merely looks like dates.

The series names or labels are wrong: Open Chart Design > Select Data. The dialog lets you inspect the chart data range, edit a series name, and adjust the category-axis label range. Correcting a header or range there is often better than repeatedly switching rows and columns.

The vertical scale is misleading: Right-click the vertical axis and choose Format Axis to review its bounds, units, and number format. A manually set minimum can make small changes look dramatic; a zero baseline can be important for some comparisons. Choose bounds that suit the message and do not disguise the size of differences.

Make the chart easier to read

Once the data is oriented correctly, add context rather than relying on the legend alone. Use Chart Design > Add Chart Element > Axis Titles to label what each axis measures, and give the chart a descriptive title. Include units such as dollars, minutes, or degrees where they matter. If the horizontal axis contains dates, choose a date format that stays legible without crowding the chart.

Limit the number of series when possible. Many lines with similar colors can make a chart difficult to interpret, even if the axes are technically correct. If one series is on a very different scale from the others, a secondary axis may be possible through series formatting, but it can also make comparisons confusing. Consider separate charts when readers need to compare values directly and the scales are substantially different.

Line charts connect observations, so use them when the order of categories carries meaning, commonly time or a progression. For unrelated categories such as departments, connected lines can imply a continuous sequence that does not exist. A bar or column chart may communicate those comparisons more clearly.

Frequently Asked Questions

Can I swap the X and Y axes in an Excel line chart?
A line chart does not offer a true numeric X/Y swap. Use Switch Row/Column to change the series arrangement, or change the chart to XY (Scatter) when both coordinates are numeric.

Does Switch Row/Column transpose my worksheet data?
No. It changes how the chart interprets the selected rows and columns. The source cells remain in their original positions, and the chart’s horizontal category axis and vertical value axis remain in their usual roles.

How do I put time on the horizontal axis and measurements on the vertical axis?
For a sequence of dates with measurements, a line chart is often appropriate: use the date column as category labels and the measurement column as the series. If the actual spacing between dates must control point positions, use an XY scatter chart and assign the date values as X values.

Why is Switch Row/Column unavailable?
First select the chart so that the chart-specific ribbon appears. If the command remains unavailable, check that the chart and its data range are editable and that you are not working with a chart type or data source that restricts the command. You can also review the selected range through Chart Design > Select Data.

Can I reverse the order of the X-axis labels without swapping axes?
Yes. Right-click the horizontal axis, choose Format Axis, and select Categories in reverse order under Axis Options. That reverses the category display order, not the chart’s X and Y roles.

Related

Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.

More in Charts & pivot tables

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.