Sort a List Numerically

Sorts lines by the number in them, so 9 comes before 10, $1,299 comes after $99, and 2M beats 500k.

Advertisement

Good for

Price lists and resale listings, scores and grades, sports and game stats, file sizes, order or ticket numbers, and measurements. If your numbers are in a particular column, such as a score after a name, use Sort by column to pick it exactly.

Why not just alphabetize?

An alphabetical sort compares numbers one character at a time, so “100” comes before “9” because 1 is less than 9. A numerical sort reads the whole number, so you get 9, 25, 100 the way you’d expect.

What counts as a number

  • Whole numbers, decimals and negative numbers: 42, 3.14, -7
  • Thousands separators: 1,299 is read as one thousand two hundred ninety-nine
  • Money and units: $19.99, 250ms, 16GB
  • Shorthand: 1.5k = 1,500, 2M = 2,000,000, 3G = 3,000,000,000

If a line has more than one number, it’s sorted by the largest one. Lines with no number at all move to the top, in their original order.

Plain numbers

Before
100
9
-3
25.5
1,000
0.75
After
-3
0.75
9
25.5
100
1,000

Lines with numbers in them

Before
Laptop $1,299
Mouse $25
Monitor $189.99
Cable $7
Desk $350
After
Cable $7
Mouse $25
Monitor $189.99
Desk $350
Laptop $1,299

Short forms like k and M

Before
Channel A: 950k subscribers
Channel B: 1.2M subscribers
Channel C: 12k subscribers
After
Channel B: 1.2M subscribers
Channel A: 950k subscribers
Channel C: 12k subscribers

Questions

Why did a line with two numbers end up in an odd place?

Lines are sorted by the largest number they contain. For a line like “Room 12, 300 sq ft” that’s 300. To sort by a specific column, use Remove text before or after to cut each line down first.

Can I sort numbers separated by commas?

Yes. Set “Items are separated by” to Commas, or let it be detected automatically when the list is on one line.

How do I sort dates?

For month names use Sort by month. Dates written as YYYY-MM-DD already sort correctly with Alphabetize.