Sorting is one of the most common tasks in the daily use of Excel. You need to perform various sorts; sort multiple columns, sort dates, sort data chronologically, and many more. Today we are going to show you how to sort duplicates in Excel. For this session, we are using Excel 2019, you can use your preferred version.
Download Practice Workbook
You are welcome to download the practice workbook from the link below.
2 Easy Ways to Sort Duplicates in Excel
First things first, let’s get to know about the workbook which is the base of today’s examples.
Here we have a dataset of several items along with their quantity. There are duplicate items on purpose. Using this dataset we will see how to sort duplicates in Excel.
Note that this is simply dummy data to keep things straightforward. In real-life scenarios, you may encounter a much more complex and bigger dataset.
1. Sort Duplicates in Columns
Let’s first see how to sort duplicates in columns.
- To sort duplicates in columns we first need to introduce a new column: Counter (we have named it Counter, you can name it as you wish).
- In this column, we will count the number of times each item occurs in the Items We are going to use the COUNTIF function to find the occurrence numbers.
- The COUNTIF function counts cells in a range that meets a single condition. To know more about this function, visit this COUNTIF
- Here our formula will be
- Here, $B$5:$B$22 is the range to count, and B5 is the criteria. This will provide the total number of Apples within the Items
- To find the instances for the rest of the items, we will exercise the Excel AutoFill feature.
- Now we can sort the data using this column.
1.1 Sort Ascending Order
Here, I will discuss how to sort duplicates in ascending order.
- To sort in ascending order select the Counter column and click A to Z in the Sort & Filter section from the Data
- Since only one column is selected from an entire table Excel will trigger a warning through the Sort Warning dialog box.
- Unless you explicitly need to sort only the selected column, select Expand the selection and click Sort.
- You will find the sorted dataset. Notice the image below, the duplicate items are in ascending order.
1.2 Sort Descending Order
Now, I will show how to sort duplicates in descending order.
- This time, to sort in descending order again select the Counter column and click Z to A from the Sort & Filter
- Again, the selection of a single column from an entire table will lead to the Sort Warning dialog box. Select Expand the selection and click Sort.
- The dataset will be sorted in descending order. See the image below
2. Sort Duplicates in Rows
Now I will show how to sort duplicates in rows. The approach will be similar to the previous method.
- We can sort duplicate values present within rows. To show you examples we have rearranged the data within rows. Our approach will be similar to the column sort, we will introduce a Counter row here.
- We will fill up the Counter row using the COUNTIF function and the formula will be the following one
- Here $C$4:$L$4 is the range to count and C4 is the criteria. We have used absolute reference for the range to keep this unchanged. This will provide the occurrence for the value in cell C4.
- Exercise the AutoFill feature to complete the row.
- Now using this row we will perform our sort operation.
2.1 Sort Ascending Order
First, I will show the method of sorting duplicates in ascending order.
- To sort rows perfectly we need to select the rows together and click Sort in the Sort & Filter section from the Data
- Now a Sort dialog box will pop up in front of you. From there select Options
- You will find another dialog box having two options; Sort top to bottom and Sort left to right.
- Select Sort left to right and click OK.
- Now you will find the rows listed in the Sort by drop-down box.
- Here our Counter row is row number 6. Select Row 6 and click OK.
- You will find the data sorted in ascending order.
2.2 Sort Descending Order
This time, I will sort the duplicates in descending order.
- From the Sort box, set the order from Largest to Smallest.
- Then, click OK.
- You will find the duplicate data in the row sorted in descending order.
Read More: How to Sort Rows in Excel (3 Easy Ways)
That’s all for today. I have elucidated 2 ways on how to sort duplicates in Excel. Hope you will find this helpful. Feel free to comment if anything seems difficult to understand. Let us know any other ways to sort duplicates that we might have missed here.
- Sort Column by Value in Excel (5 Methods)
- How to Sort Dates in Excel by Year (4 Easy Ways)
- Excel Sort Dates in Chronological Order (6 Effective Ways)
- How to Sort Columns in Excel without Mixing Data
- Sort Two Columns in Excel to Match (Both Exact and Partial Match)
- How to Auto Sort Multiple Columns in Excel (3 Ways)
- Sorting Columns in Excel While Keeping Rows Together