# Excel: Formula to Sort Numbers in Ascending or Descending Order

You can use the following formulas to sort numbers in Excel in ascending or descending order:

Formula 1: Sort Numbers in Ascending Order (Smallest to Largest)

```=SMALL(\$A\$2:\$A\$13,ROWS(\$A\$2:A2))
```

Formula 2: Sort Numbers in Descending Order (Largest to Smallest)

`=LARGE(\$A\$2:\$A\$13,ROWS(\$A\$2:A2))`

Both of these formulas will sort the numbers in the range A2:A13 in either ascending or descending order, depending on whether you use the SMALL or LARGE functions in Excel.

The following examples show how to use each formula in practice with the following column of numbers in Excel: ## Example 1: Sort Numbers in Ascending Order in Excel

We can type the following formula into cell B2 to return the smallest value from the range A2:A13:

`=SMALL(\$A\$2:\$A\$13,ROWS(\$A\$2:A2))`

We can then click and drag this formula down to each remaining cell in column B to return the numbers from the range A2:A13 in ascending order: Column B now displays the numbers in column A in ascending order (smallest to largest)

Note that this formula uses the SMALL function in Excel to return the nth smallest value in a range and then uses the ROW function to specify the value for n.

For example, the first value in column B represents the 1st smallest value in column A.

Then, the second value in column B represents the 2nd smallest value in column A.

And so on.

## Example 2: Sort Numbers in Descending Order in Excel

We can type the following formula into cell B2 to return the largest value from the range A2:A13:

`=LARGE(\$A\$2:\$A\$13,ROWS(\$A\$2:A2))`

We can then click and drag this formula down to each remaining cell in column B to return the numbers from the range A2:A13 in descending order: Column B now displays the numbers in column A in ascending order (largest to smallest).

Note that this formula uses the LARGE function in Excel to return the nth largest value in a range and then uses the ROW function to specify the value for n.

For example, the first value in column B represents the 1st largest value in column A.

Then, the second value in column B represents the 2nd largest value in column A.

And so on.