How to Fix Excel SORT Function Returning Zero
Question details
The user is trying to use the SORT function to organize a dataset, but the formula outputs a zero instead of the expected sorted list of data.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Sorting a range or array of data dynamically using the SORT function in a spreadsheet.
- Observed behavior
- The SORT function returns a 0 in the destination cells rather than spilling the correctly sorted values from the source range.
Ensure your version of Excel supports dynamic array formulas (such as Microsoft 365 or Excel 2021 and newer). Older versions do not support the SORT function and may return errors.
Identify and Handle Blank Cells in Source Data
Use this solution if your source data range contains empty cells, which Excel evaluates and returns as a zero in dynamic array functions.
When the SORT function references a range that contains blank cells, Excel's calculation engine automatically converts those blanks into zeros in the spilled output array.
To fix this, you can either clean up your source data or use a nested formula to filter out the empty cells before sorting.
Check the source array you referenced in your formula (e.g., A2:A10). Identify if any cells within this exact range are entirely empty.
Manually delete the empty rows or cells from your source dataset, then update your SORT formula's range to precisely cover only the cells with data.
Instead of manually deleting rows, modify your formula to filter out blanks automatically. Type =SORT(FILTER(A2:A10, A2:A10<>"")) and press Enter. This tells Excel to ignore any empty cells.

Verify Formula Syntax and Referenced Ranges
Check your formula parameters to ensure you are referencing the correct dataset and columns.
Clear Destination Cells for Spilled Results
Ensure the formula has enough empty space to spill the sorted results without encountering blocking values or hidden zero values.
Easily Sort Complex Data Using WPS Spreadsheet
WPS Spreadsheet fully supports advanced dynamic array functions like SORT and FILTER, making data organization seamless. You can easily sort ranges and filter out blank cells without complicated workarounds, providing a smooth experience for your daily tasks.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open the workbook containing the data you want to sort.
- 2. Select the destination cell: Click on an empty cell where you want the top of your newly sorted list to begin.
- 3. Apply the SORT function: Type =SORT( followed by highlighting your source data range. Close the parenthesis and press Enter.
- 4. Instantly view spilled results: WPS Spreadsheet will immediately sort your data and spill the results downward without formatting issues.

Frequently Asked Questions
Why does my SORT function show a #NAME? error instead of zeros?
The #NAME? error typically occurs if your version of Excel does not support the SORT function. The SORT function is a dynamic array formula available only in Excel for Microsoft 365, Excel 2021, or newer. Upgrading your software or using WPS Spreadsheet will resolve this.
How do I stop the SORT function from showing zeros for blank cells?
You can nest the FILTER function within the SORT function to exclude blanks. Use a formula structure like =SORT(FILTER(A1:A20, A1:A20<>"")). This forces the formula to evaluate only cells that contain actual data.
Can I sort by multiple columns using the SORT function?
Yes, you can use the SORTBY function instead, or nest multiple criteria inside the SORT function. The SORTBY function allows you to specify a primary array to sort and multiple secondary arrays to dictate the sorting logic without returning zeros, provided the ranges are perfectly aligned.




