"Sorting on" vs. "Sorting by"

Recently asked a question of a colleague:

Are you sorting this list by acronym?

He responded:

Yes, I’m sorting on acronym (ascending).

Emphasis mine in each case.

Is one correct and not the other? Or does it depend on what is being sorted?


"Sorting on" is restricted to the name of the data field. You can sort on acronym, antonym, homonym, or another one or more fields.

"Sorting by" is less restricted. Not only can you sort by acronym, you can sort by length, size, color, columns, or rows. To illustrate, "sort on" would not have worked in the preceding sentence.


I think this is yet another example where versitile, two-letter prepositions have overlapping meanings, and therefore either one could be used.

In the context of sorting, both are found in the literature; here are some with on:

  • In this exercise you will sort on the Last Name and First Name fields.1
  • For example, if you have a name field containing both the first name and surname then, when you sort, the program will sort on the first character of the field which may not be the surname.2
  • This command will sort on ORG in ascending sequence, and for the same ORG, it will sort on SALARY in descending sequence.3

and here are some examples with by:

  • Instead, it will sort by the leftmost column first, through to the rightmost column, for any number of columns up to 256.4
  • If the user clicks on the heading Items Worked, the area will sort by that item.5
  • If, however, more than one row is returned per company name, then we will sort by the contact's last name.6

Given that each of these prepositions has well over a dozen meanings 7, and that some of these definitions are rather vague and general-purpose, it should hardly be surprising to run across contexts where either word could be used. For example, here are some definitions from Collins that would indicate these words can sometimes be used interchangeably:

on: with regard to; concerning

by: with respect to

By the way, neither sentence in the original question struck me as "off" in any way.

R E F E R E N C E S    &    N O T E S
1 I. Murphy, No Stress Tech Guide to Microsoft Works 8 & 8.5, 2006.
2 D. Weale, Excel 2000: Basic Skills, 2001.
3 K. D. Bharucha, dBase III plus: A Comprehensive User's Manual, 1987.
4 D. & R. Rawley, Excel Hacks: Tips & Tools for Streamlining Your Spreadsheets, 2007.
5 G. Knight, Analyzing Business Data with Excel, 2006.
6 P.J. Horwood, Power++ Developer's Professional Reference, 1997.
7 Collins, for example, lists 26 meanings for by, and 48 for on.