How to sort rows by odd or even numbers in Excel?
It is easy for us to sort the numbers by ascending or descending order in Excel, but if I have a long list of numbers, and now I want to sort them by odds or evens. That is to say, all odd or even numbers are sorted together as following screenshots shown. Is it possible for us to sort by even or odd numbers in Excel?
To sort the list of numbers by odds or evens, you need to create a helper column to identify the odd or even numbers, and then apply the Sort function.
1. Next to the numbers, please enter this formula =ISODD(A2) in a blank cell, see screenshot:
2. Then drag the fill handle over to the cells that you want to contain this formula, the TRUE indicates odd numbers and FALSE indicates even numbers, see screenshot:
3. Then you can sort the column B that you are created by clicking Data > Sort Smallest to Largest or Sort Largest to Smallest as you want.
4. And in the Sort Warning dialog, check Expand the selection option, see screenshot:
5. Then click Sort button and the even numbers has been sorted together and then followed by the odd numbers if you select Sort Smallest to Largest icon. See screenshot:
1. If you want to sort all odd numbers before the even numbers, you just need to select Sort Largest to Smallest in Step 3.
2. After finishing the sorting, you can delete the helper column as you need.
Here, I can talk about an easy tool – Kutools for Excel, with its Advanced Sort feature, you can quickly sort all odd numbers together and followed even numbers or vice versa.
|Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.|
After installing Kutools for Excel, please do as follows:
1. Select the data range that you want to sort.
2. Then click Kutools Plus > Sort > Advanced Sort, see screenshot:
3. In the Advanced Sort dialog box, click the column name that you want to sort by under Column section, and then choose Odd and even number from the Sort On section, at last specify the sort order (A to Z stands for from even to odd numbers, and Z to A stands for from odd to even numbers), see screenshot:
4. And then click OK, and you will get the following results:
|Original data||Sort from even to odd numbers||Sort from odd to even numbers|