logo
search
Function Problems

How to Sort Numbers Using a Formula in Excel 2013

Algirdas JasaitisAlgirdas Jasaitis Sep 30, 2026 869 views

Question details

The user needs a formula-based method to sort a column of numbers in ascending order in Excel 2013, avoiding the manual Data Sort command despite the absence of the modern SORT function.

How to Sort Numbers with an Excel 2013 Formula
Product
Microsoft Excel 2013
Device & OS
not provided
Scenario
Automating the sorting of a numerical dataset into another column dynamically using formulas.
Observed behavior
Excel 2013 lacks the native dynamic array SORT function, requiring a complex legacy array formula combination to achieve the automated sort.
Before you start

Verify if your dataset contains duplicate numbers, as standard array sorting formulas may require a helper column to break ties without returning errors.

Solution 1Recommended

Use an INDEX, MATCH, and COUNTIF Array Formula

This method utilizes a legacy array formula to dynamically rank and sort numbers without utilizing the manual Data Sort tool.

Because Excel 2013 does not support the modern SORT function, you must combine INDEX, MATCH, and COUNTIF. This calculates the rank of each number by counting how many values are smaller than or equal to it, then extracts them in ascending order.

1
Select the Destination Cell

Click on the first cell of your target column where you want the sorted list to begin (for example, cell C2).

2
Enter the Array Formula

Type the following formula exactly: =IFERROR(INDEX($A$2:$A$15,MATCH(ROWS($A$2:A2),COUNTIF($A$2:$A$15,"<="&$A$2:$A$15),0)),""). Adjust the range $A$2:$A$15 to match your actual data.

3
Confirm as an Array Formula

Instead of pressing Enter, press Ctrl + Shift + Enter simultaneously. Excel will wrap the formula in curly brackets {} to indicate it is an array formula.

4
Apply to Remaining Cells

Click the small square at the bottom-right corner of the cell (the fill handle) and drag it down to apply the formula to the rest of the column.

Use an INDEX, MATCH, and COUNTIF Array Formula
Important Array Formula Step: If you just press Enter, the formula will not evaluate the array properly and may return an error. You must use Ctrl+Shift+Enter in Excel 2013.

Sort Data Instantly with WPS Spreadsheet

Upgrade your spreadsheet experience with WPS Office. Newer versions of WPS Spreadsheet fully support modern dynamic array functions like SORT, saving you from typing complex legacy INDEX/MATCH formulas to arrange your data.

  1. 1. Open Your Document: Launch WPS Spreadsheet and open the document containing the numbers you want to sort.
  2. 2. Select the Target Cell: Click on the blank cell where you want the sorted numbers to appear.
  3. 3. Enter the SORT Function: Simply type =SORT(A2:A15) (adjusting the range to match your data) and press Enter.
  4. 4. View Sorted Results: The sorted numbers will automatically spill down into the adjacent cells in perfectly ascending order without any helper columns or special keystrokes.
Fully compatible with Microsoft Excel formats (.xlsx, .xls, .csv)Supports modern dynamic array functions including SORT, FILTER, and UNIQUENo need for Ctrl+Shift+Enter; formulas spill automaticallyLightweight, fast, and completely free to download
microsoft office alternative - wps office

Frequently Asked Questions

Why does my formula return a #VALUE! or #N/A error?

This usually happens if you press only Enter instead of Ctrl+Shift+Enter. Legacy array formulas in Excel 2013 require you to confirm them with Ctrl+Shift+Enter so Excel knows how to evaluate the array correctly.

Can I sort data in descending order using this formula?

Yes. You can change the "<=" operator in the COUNTIF segment of the formula to ">=" to count values that are greater than or equal to the current value, which reverses the sorting order.

Will this array formula work for sorting text alphabetically?

Yes, the COUNTIF function evaluates alphabetical order as well. However, it is case-insensitive, so strings like 'apple' and 'Apple' will be treated as having the exact same rank.