How to Sort an Excel Chart Without Changing Source Data

Charts & pivot tables · Updated November 3, 2026

How to Sort an Excel Chart Without Changing Source Data

To sort an Excel chart without changing its source data, create a separate helper range with a formula such as =SORTBY(A2:B6,B2:B6,-1), then build the chart from that sorted range. The original table stays in its existing order, while the chart displays categories in the order you choose.

What It Means to Sort a Chart

An ordinary chart takes its category labels and values from cells in a worksheet. For a column chart showing product sales, for example, Excel usually presents the products in the same sequence as the source rows. Sorting the source table changes that row sequence, which may be undesirable if the table is arranged for another purpose, such as matching a report, preserving entry order, or supporting other formulas.

Excel does not provide a universal command that independently sorts every chart’s categories while leaving its source range untouched. Instead, you can give the chart a different range to read. A formula-driven helper range is usually the clearest approach: it creates a sorted view of the source data without moving or replacing the original cells. A PivotChart can also work when the data is summarized in a PivotTable.

It is useful to distinguish sorting from reversing. Reversing changes the displayed direction of the existing category sequence; sorting rearranges categories according to a rule, such as sales from highest to lowest or names alphabetically. Reversal can be done in a chart’s axis settings, but it does not calculate a new order.

Sort a Helper Range with SORTBY

In Microsoft 365 for Windows, the most flexible method for a small, ordinary chart is to create a sorted copy with SORTBY. The function returns rows from one range in the order determined by another range. Because the results spill into neighboring cells, make sure those cells are empty.

Suppose A1:B6 contains headers in row 1 and five products and sales figures in rows 2 through 6. The product names are in A2:A6 and the sales figures are in B2:B6. Enter Product and Sales as headers in D1 and E1. With that layout, enter this formula in D2 to sort complete rows from highest sales to lowest:

=SORTBY(A2:B6,B2:B6,-1)

The result keeps each name beside its correct sales figure. If the source rows are Cedar 42, Maple 18, Birch 35, Ash 27, and Elm 50, the helper range returns Elm 50, Cedar 42, Birch 35, Ash 27, and Maple 18. The original A2:B6 remains unchanged. The final argument -1 means descending order; use 1 for ascending order.

To sort the same data alphabetically by the first column instead, with the same source layout, put this formula in D2:

=SORT(A2:B6,1,1)

Here, 1 identifies the first column of the array as the sort column, and the last 1 requests ascending order. SORT and SORTBY are available in Microsoft 365 and Excel 2021 or later. If your Excel version does not support dynamic arrays, use a PivotTable, a manually maintained helper range, or another method described below.

Build the Chart from the Sorted Results

  1. Check that the formula has filled the helper range and that its headers match the data beneath them.
  2. Select the helper headers and results, such as D1:E6.
  3. Choose Insert, then select the chart type that suits the comparison, such as a clustered column or bar chart.
  4. Confirm that the chart uses the helper labels as categories and the helper figures as values.
  5. Leave the original source table in place. When its values change, the formula recalculates and the chart reflects the new order.

For a fixed-size source range, selecting the full helper range including its headers is straightforward. If you add or remove records regularly, plan for the chart range to include the changing results. You can use an Excel Table as the source for formulas, and you may need to adjust the chart’s data range as the number of returned rows changes. Dynamic-array results can be referenced with spill-range notation in supported Excel features, but chart setup can vary; check the chart’s Select Data settings if it does not include all results.

On Excel for Mac, SORT and SORTBY work in supported Microsoft 365 and Excel 2021 versions as they do on Windows. Ribbon appearance and some chart-pane labels can differ by release, but the basic process—enter a formula in a clear helper area and chart its results—is the same. Excel for the web also supports many dynamic-array functions, though chart editing options may differ from the desktop app.

Choose the Right Sort Rule

Decide what order the chart should communicate before choosing a formula. Descending values make the largest contributors easy to spot. Ascending values can help reveal the smallest values or show a sequence from low to high. Alphabetical sorting is useful for finding a named category, but it does not rank performance.

  • Rank by one measure: Use SORTBY with the value column, as in the sales example.
  • Arrange labels alphabetically: Use SORT with the category column’s position in the selected range.
  • Keep a deliberate custom order: Add a separate numeric order column, then sort by it. For example, assign 1 to First, 2 to Second, and 3 to Third.
  • Break ties consistently: Sort by a second range after the main value, such as the category names. SORTBY can accept additional sort-by and sort-order pairs.

With a custom order stored in C2:C6 and the data still in A2:B6, this formula in D2 sorts the whole two-column record by the order numbers:

=SORTBY(A2:B6,C2:C6,1)

That arrangement is more dependable than trying to force a chart into a sequence that has no explicit rule. It also makes the intended order visible to anyone reviewing the workbook.

When a PivotChart Is a Better Fit

A PivotChart is useful when the chart should summarize a larger dataset, group repeated records, or let users filter categories. Create a PivotTable from the source, add the relevant field to Rows and the measure to Values, and insert a PivotChart from the PivotTable. Sorting the PivotTable’s categories by the summarized value changes the order shown by the PivotChart without sorting the original data table.

For example, if a transaction list contains many rows for each product, a PivotTable can total sales by product. Sort the product items by the sales total, then use the connected PivotChart to display that ranking. The source transactions stay in their original order; the PivotTable is a separate summary. The exact sort choices depend on the fields and layout, so select a category in the PivotTable and use its sort options to sort by the value field you want.

A PivotChart is not always the simplest choice for a short, already summarized list. It adds a PivotTable and may introduce field buttons or filtering behavior that is unnecessary for a basic chart. Use a formula helper range when the data is already in the shape the chart needs and you want an uncomplicated sorted copy.

Reverse Order, Filters, and Other Chart Controls

If you only want the first category to appear at the opposite end of the chart, use the category axis settings rather than a sorting formula. Select the category axis, open Format Axis, and under Axis Options select Categories in reverse order. This changes the visual direction of categories but preserves their relative order. On a horizontal bar chart, reversing the category axis can also affect where the value axis appears, so check the result and adjust the axis crossing option if needed.

Chart filters serve a different purpose: they hide or show selected categories or series. They can reduce clutter, but they do not create a new ranking of the remaining categories. Likewise, Select Data lets you change the chart’s source range and series, but it is not a general sort tool for category rows. Reordering series changes the order of plotted data series, not the order of individual category labels.

Common Problems and How to Fix Them

  • The formula shows a spill error: Clear cells where the results need to appear. A value, merged cell, or another obstruction in the spill area can prevent the formula from returning its full array.
  • Names no longer match their values: Sort whole rows with SORTBY, not just the values column. Sorting labels and figures separately can break the relationship between them.
  • The chart looks unchanged: Check that its data source points to the helper range rather than the original table. Use the chart’s Select Data option to inspect or update the range.
  • The chart order seems upside down: Bar and column charts place categories on different axes. Check whether the axis is reversed before changing the formula’s sort direction.
  • Some records appear in the wrong place: Check for numbers stored as text, extra spaces in labels, blanks, or errors in the source. Text-formatted numbers may not sort as expected alongside numeric values.
  • New rows do not appear: The formula or chart range may refer only to the original fixed-size block. Expand the source range or use a Table-based setup, then verify that the chart includes the additional results.

Also decide how blanks and ties should behave. A descending sort can place equal values together, but their relative order may not express a meaningful preference. If readers need a stable tie-break, sort by a second key such as the category label. If blanks should not appear as chart categories, exclude them from the helper data or handle them deliberately rather than assuming the chart will ignore them in every layout.

Frequently Asked Questions

Can I sort chart bars without sorting the worksheet data?
Yes. Make a sorted helper range with SORT or SORTBY and create the chart from that range. The source cells stay in their original order.

Can I sort a chart from largest to smallest?
Yes. Use SORTBY with the measure column and a sort order of -1. For example, if categories are in A2:A6 and values are in B2:B6, sort the full A2:B6 rows by B2:B6 descending, then chart the results.

Can I sort the chart alphabetically?
Yes. Use SORT on the helper range and specify the category column as the sort index. The chart must use the resulting helper range as its data source.

Does reversing the category axis sort the chart?
No. It flips the displayed direction of the existing category sequence. It does not rank values or arrange labels alphabetically.

Will the chart update when the source data changes?
The SORT or SORTBY formula recalculates when its referenced values change, and a chart linked to the helper results can update accordingly. If the number of source rows changes, make sure the formula and chart range cover the added or removed rows.

Can I do this without SORTBY?
Yes. A PivotChart can follow a sorted PivotTable while leaving the raw data alone. Older Excel versions can also use a manually sorted helper range, but that copy will not automatically reorder itself when the source values change.

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.