Function Problems

How to Fix Excel SORT Function Returning Zero

Camila MilosovichCamila Milosovich Oct 20, 2026 872 views

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.

How to Fix Excel SORT Function Returning Zero
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.
Before you start

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.

Solution 1Recommended

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.

1
Locate blank cells in your range

Check the source array you referenced in your formula (e.g., A2:A10). Identify if any cells within this exact range are entirely empty.

2
Remove empty rows

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.

3
Use the FILTER function to exclude blanks dynamically

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.

Identify and Handle Blank Cells in Source Data
Pro Tip: Nesting the FILTER function inside your SORT formula ensures your sorted list stays perfectly clean, even if you add or remove data from the source range later.
Advanced Data Sorting

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. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open the workbook containing the data you want to sort.
  2. 2. Select the destination cell: Click on an empty cell where you want the top of your newly sorted list to begin.
  3. 3. Apply the SORT function: Type =SORT( followed by highlighting your source data range. Close the parenthesis and press Enter.
  4. 4. Instantly view spilled results: WPS Spreadsheet will immediately sort your data and spill the results downward without formatting issues.
Fully compatible with Microsoft Excel formulas and .xlsx filesBuilt-in support for modern dynamic array functionsFree, lightweight, and fast performance for large datasets
microsoft office alternative - wps office

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.