How to Fix Excel Sorting When Equal Values Are Not Equal
Question details
Users encounter incorrect sorting results because values that appear identical actually contain hidden floating-point differences.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Sorting a dataset containing calculated values that appear visually identical but are evaluated differently by the sorting engine.
- Observed behavior
- Excel sorts the data based on the underlying decimal precision rather than the rounded display value, causing visually equal numbers to sort in an unexpected order.
Temporarily increase the decimal display for the cells you are trying to sort. This will help you identify any hidden microscopic fractions causing the floating-point inconsistencies.
Use the ROUND Function Before Sorting
The most reliable way to sort floating-point numbers correctly is to round the calculated values to a specific decimal place before applying the sort.
Excel stores numbers with up to 15 digits of precision. Standard calculations can sometimes introduce tiny decimal fractions known as floating-point errors. By using the ROUND function, you force the underlying precision to match the displayed value, allowing the sort function to recognize genuine ties.
Insert a new column next to the data you want to sort.
Enter the formula =ROUND([Your Calculation], 1) into the first cell of the helper column. For example, use =ROUND(SUM(G5:L5), 1) to round to one decimal place.
Drag the fill handle down to apply this rounding formula to the rest of the column.
Select your entire dataset, navigate to the Data tab, click Sort, and sort by your new helper column from largest to smallest. You can then apply a secondary sort on another column to break the ties.

Use the SORT Formula Array
If you are using a newer version of Excel, you can use the dynamic array SORT function to handle complex multi-column sorting automatically.
Easily Manage and Sort Complex Data with WPS Spreadsheet
WPS Spreadsheet provides powerful data handling, precise calculation capabilities, and seamless compatibility with standard Excel formulas like ROUND and SORT. Solve floating-point sorting issues quickly in a lightweight, free environment.
- 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your .xlsx workbook that contains the sorting issue.
- 2. Apply the ROUND formula: Use the =ROUND() function in a helper column to standardize the underlying values.
- 3. Sort via the Data tab: Navigate to the Data tab, select Sort, and configure your primary and secondary sorting levels based on the rounded values.

Frequently Asked Questions
Why does Excel show numbers as equal when they aren't?
Spreadsheet software formats cells to display a limited number of decimal places for better readability. However, calculations can leave hidden microscopic fractions (floating-point errors) in the background memory, making visually identical numbers technically different when evaluated by the sorting engine.
Does changing the cell format fix floating-point sorting issues?
No, changing the cell format (such as reducing the decimal places using the toolbar buttons) only changes how the number is displayed on the screen. The software still uses the underlying precise value for sorting and calculations. You must use a function like ROUND to change the actual stored value.
Can I sort by multiple columns to break ties after rounding?
Yes. Once you round your primary values so that true ties exist, you can go to Data > Sort, click 'Add Level', and choose a secondary column. This determines the exact order of rows that have identical primary values.




