Recently asked a question of a colleague:
Are you sorting this list by acronym?
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:
and here are some examples with by:
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:
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