How to Sort Excel Formula Results Numerically Instead of Alphabetically
Question details
The user wants to sort formula results numerically (Smallest to Largest) instead of alphabetically (A to Z).

- Product
- Excel / WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- Filtering and sorting data generated by logical or text formulas in a worksheet.
- Observed behavior
- The filter menu offers 'Sort A to Z' and 'Sort Z to A' instead of numerical sorting options, treating the formula outputs as text instead of numbers.
Select the column containing your formula results and ensure no cells are formatted as pure Text. You can also use the ISNUMBER function in an adjacent cell to check if your data is actually being recognized as numerical values before attempting to sort.
Remove Quotation Marks from Formula Outputs
Modify your IF statements or other formulas to output raw numbers instead of text strings wrapped in quotation marks.
The most common cause of numbers sorting alphabetically is the use of quotation marks around numeric outputs in formulas (e.g., =IF(A1<=1000,"1","2")). Excel treats anything inside quotation marks as a text string, which forces an A-to-Z sort.
Click on the first cell in your column that contains the formula you want to correct.
Look at the formula bar at the top of the screen. Identify any numeric outputs that are wrapped in quotation marks.
Remove the quotation marks around the numbers. For example, change =IF(A1<=1000,"1","2") to =IF(A1<=1000,1,2).
Press Enter to apply the change, then double-click the small square fill handle at the bottom right of the cell to copy the updated formula down the rest of the column.
Click the filter drop-down arrow on your column header. The sorting options should now properly display 'Sort Smallest to Largest' and 'Sort Largest to Smallest'.

Convert Text to Numbers Using Math Operations or VALUE
If you cannot change the core structure of your formula, append a mathematical operation or use the VALUE function to force Excel to treat the text result as a number.
Easily Sort and Analyze Data with WPS Spreadsheet
WPS Spreadsheet provides robust data sorting, filtering, and formula evaluation tools. It perfectly handles numerical and text data, allowing you to seamlessly manage complex datasets and easily fix formatting issues without changing your workflow.
- 1. Open your document: Launch WPS Office and open your Excel workbook in WPS Spreadsheet.
- 2. Select your data: Highlight the column containing your formula results.
- 3. Enable filtering: Navigate to the 'Data' tab on the top ribbon and click on the 'AutoFilter' button.
- 4. Sort numerically: Click the filter drop-down arrow on your column header to access 'Sort Smallest to Largest' and organize your numeric data perfectly.

Frequently Asked Questions
Why does Excel sort my numbers like 1, 10, 11, 2?
This happens when your numbers are stored as text. Alphabetical (text) sorting evaluates characters character-by-character from left to right. Because the first character of '10' is '1', it places '10' before '2', just as 'Apple' comes before 'Banana'.
How can I quickly check if my formula results are text or numbers?
You can use the =ISNUMBER(cell_reference) formula in a blank adjacent cell. If it returns TRUE, the formula result is a real number. If it returns FALSE, the result is being treated as text.
Does changing the cell format to 'Number' fix this sorting issue?
Changing the cell format via the 'Format Cells' menu is often not enough if the formula explicitly outputs text strings. You must edit the formula to remove quotation marks or use a conversion function like VALUE() to permanently resolve the issue.




