Excel Chart Data Order: How to Sort and Rearrange
In this article
To change the order of data in an Excel chart, you must sort the source data in the spreadsheet itself, as charts are dynamic reflections of their underlying data range. Because Excel plots data in the order it appears in the cells, rearranging the rows or columns in your table will automatically update the sequence of bars, slices, or points in your chart.
What You'll Need
- A computer with Microsoft Excel installed (Windows or macOS).
- An existing dataset with a chart already created, or a table ready for charting.
- Administrative permissions to edit the workbook.
Step-by-Step
- Identify Your Source Data: Click on any element of your chart. Excel will automatically highlight the range of cells in your worksheet that are feeding the chart. This ensures you are sorting the correct data set and not a neighboring table.
- Select the Data Range: Highlight the entire table used for the chart, including the headers. If you only select one column, you risk mismatching your labels and your values, which will lead to inaccurate chart data.
- Open the Sort Menu: Navigate to the Data tab on the top ribbon. In the Sort & Filter group, click the Sort button. This opens the Sort dialog box, which provides more control than the quick A-Z buttons.
- Define the Sort Criteria: In the Sort dialog box, ensure the checkbox My data has headers is checked. Under the Column dropdown, select the column you want to base the order on. For example, if you want your chart bars ordered from highest to lowest value, select the column containing the numeric values.
- Choose the Order: In the Order dropdown, choose Smallest to Largest (Ascending) or Largest to Smallest (Descending). Click OK. You will notice the spreadsheet rows shift, and the chart will update instantly to reflect this new sequence.
- Handle the "Reverse Order" Issue (Bar Charts): If you are using a Bar Chart (horizontal bars), you may notice that Excel plots the data from the bottom up, meaning the top row of your spreadsheet appears at the bottom of the chart. To fix this:
- Right-click on the vertical axis (the category labels).
- Select Format Axis from the context menu.
- In the Format Axis pane on the right, look for the Axis Options tab.
- Check the box labeled Categories in reverse order. This will flip the chart so the first row of your data is at the top.
- Custom Sorting for Non-Alphabetical Data: If you have data that doesn't follow alphabetical or numerical order (such as "Low, Medium, High" or "January, February, March"), a standard sort won't work.
- Go to File > Options > Advanced.
- Scroll down to the General section and click Edit Custom Lists....
- Enter your desired order in the List entries Add .
- Return to the Data > Sort menu. In the Order dropdown, select Custom List... and choose your newly created list.
Common Mistakes
One of the most frequent errors is sorting only a single column of data without expanding the selection to the rest of the table. When Excel asks if you want to "Expand the selection," clicking "Continue with current selection" will decouple your labels from your values. This results in a chart that looks correct but displays the wrong data for each category, which can lead to critical reporting errors.
Another common mistake is attempting to find a "Sort" button within the Chart Design or Format tabs. Many users spend time searching the chart-specific menus for a way to rearrange the bars. It is important to remember that the chart is a visual layer; the logic and order reside entirely within the spreadsheet cells. If you want to change the visual order, you must change the cell order.
Users also frequently forget to check the "Categories in reverse order" setting for horizontal bar charts. This leads to frustration when the user sorts their data "Largest to Smallest" in the table, but the chart shows the smallest bar at the top. This is not a bug, but a default plotting behavior for the XY axis in Excel.
Tips
For those who frequently update their data, using an Excel Table (Ctrl+T) is highly recommended. When you convert your data range into an official Table, any sorting you perform is more stable, and any new data added to the bottom of the table is automatically included in the chart range without needing to manually update the data source.
If you need to maintain the original order of your data for other purposes but want a sorted chart, create a "Helper Table." Use formulas like =SORT() (available in newer versions of Excel) to create a dynamic, sorted copy of your data in a different area of the sheet. Point your chart to this helper table instead of the primary data source. This allows you to keep your raw data intact while presenting a sorted visualization.
When dealing with dates, ensure your cells are actually formatted as Date types and not as Text. If dates are stored as text, Excel will sort them alphabetically (e.g., April will come before January), which will ruin the chronological order of your line or area charts.
Troubleshooting
The chart is not updating after I sort the data: First, check if your calculation options are set to Manual. Go to the Formulas tab, click Calculation Options, and ensure Automatic is selected. If it was set to Manual, the chart won't reflect changes until you press F9.
The sort is ignoring some rows: This usually happens when there are blank rows within your data range. Excel often treats a blank row as the end of the data set. Ensure there are no completely empty rows or columns between your headers and the last piece of data. If you have blanks, delete them or fill them with "N/A" before sorting.
My custom list isn't appearing in the sort menu: Verify that you clicked Add after typing your list in the Custom Lists dialog. If you simply typed the list and clicked OK, the list was not saved. Return to File > Options > Advanced > Edit Custom Lists and ensure your list is visible in the left-hand column before attempting to sort again.
The axis labels are overlapping or disappearing: When you change the order of data, the length of the labels might change. If long labels are now in a position where they don't fit, Excel may hide some or tilt them. Right-click the axis, select Format Axis, and under Size & Properties, adjust the Custom angle or change the Text direction to make them legible.
Frequently Asked Questions
Can I sort a chart without changing the spreadsheet?
No, Excel charts are directly linked to the source cells. To change the order in the chart, you must sort the source data or create a sorted copy of the data using a helper table or the SORT function.
Why does my bar chart show the data in reverse?
By default, Excel plots the first row of data at the bottom of a horizontal bar chart. To fix this, go to Format Axis and check the "Categories in reverse order" box.
How do I sort my chart by date instead of alphabetically?
Ensure your date column is formatted as a Date type. Then, use the Data > Sort menu and select the date column; Excel will automatically recognize the chronological order.
Can I create a chart that sorts itself automatically?
Yes, by using the =SORT() function to create a dynamic range and basing your chart on that range. Whenever the raw data changes, the SORT function updates the helper table, which in turn updates the chart.
Does sorting the data affect other formulas in my sheet?
As long as you select the entire table (all columns) before sorting, your data integrity remains intact. However, if you have formulas that reference specific cell addresses (like =B2*10) instead of table references, those formulas may point to different data after a sort.
How do I sort a Pie Chart?
Pie charts follow the order of the data in the spreadsheet. To rearrange the slices, sort your data table by the value column. The largest slice will typically be plotted starting at the 12 o'clock position and moving clockwise.