How to Count the Order of Occurrence of Duplicates in Excel (4 Methods)

Method 1 – Use COUNTIF Function

This method allows you to count the order of occurrence of any type of values in Excel cells, such as text or numbers. Let’s focus on the contents of the Category column.

Follow these steps:

  • In cell E5, insert the following formula:
=COUNTIF($B$5:$B5, B5)

Where,

    • $B$5:$B5 represents the cell range array.
    • B5 is the first cell in the Category column.
  • Press ENTER.

Use COUNTIF Function to Count the Order of Occurrence of Duplicates in Excel

  • Drag the Fill Handle icon from cell E5 to E12 to get the count of duplicate occurrences in the Category column.

Related Content: How to Count Duplicates in Column in Excel


Method 2 – Combine IF & COUNTIF Functions

This method is similar to the first one but focuses on the Price column.

Here’s how:

  • Select cell E5 and insert this formula:
=IF(COUNTIF(D:D,D5)>1,COUNTIF(D$5:D5,D5),"")

Where,

    • D:D represents the cell range array for the Price column.
    • D5 is the first cell in the Price column.
    • COUNTIF(D:D,D5)>1 calculates whether each of the values of the Price column exists more than once.
    • IF(COUNTIF(D:D,D5)>1,COUNTIF(D$5:D5,D5),””) returns the value of COUNTIF(D$5:D5,D5), if any duplicate value is found. Otherwise, it returns a null value.
  • Press ENTER.

Join IF & COUNTIF Functions to Compute the Order of Occurrence of Duplicates in Excel

  • Drag the Fill Handle icon to the end of the Order column.

You will get the count of the order of the occurrence of duplicates of the Price column value in the Order column.

Read More: How to Count Duplicates in Two Columns in Excel


Method 3 – Count Running Order of Occurrence

This method counts the order of occurrence for a specific item (e.g., Wafer) in the Category column:

  • Insert this formula in cell E5:
=IF(B5="Wafer",COUNTIF($B$5:B5,"Wafer"),"")

Where,

    • B5=”Wafer” refers to the item “Wafer”.
    • $B$5:B5 is the cell range array.
    • “Wafer” is the sample item used to check for duplicates.
    • IF(B5=”Wafer”,COUNTIF($B$5:B5,”Wafer”),””) returns the order of occurrence of “Wafer” using COUNTIF($B$5:B5,”Wafer”). If no duplicate is found it returns a null value.
  • Press the ENTER.

Combine IF & COUNTIF Functions to Count the Running Order of Occurrence of Duplicates in Excel

  • Drag the Fill Handle icon from cell E5 to E12.

You will see the count of the order of occurrence of “Wafer” as in the picture below:

Read More: How to Count Duplicate Rows in Excel


Method 4 – Use Only IF Function

For a simple formula using the IF function, follow these steps:

  • Insert “1” in the top cell of the Order count column (default count for the first item).
  • In the next cell (E6), enter this formula:
=IF(D6=D5,E5+1,1)

Where,

    • D6 is the second item in the Price column.
    • D5 is the top cell of the Price column.
    • E5 contains the default count i.e. 1.
  • Press ENTER.

Use Only IF Function to Calculate the Order of Occurrence of Duplicates in Excel

  • Drag the Fill Handle icon to the end of the Order column.

You’ll now have the order count of duplicate occurrences for items in the Price column.

Calculation of the Order of Occurrence of Duplicates in Excel

Read More: How to Count Duplicate Values in Multiple Columns in Excel


Download Practice Workbook

You can download the practice workbook from here:


Related Articles


<< Go Back to Duplicates in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mrinmoy Roy
Mrinmoy Roy

Mrinmoy Roy, a dedicated professional with a BSc in Electronics and Communication Engineering from Khulna University of Engineering & Technology, Bangladesh, brings over two years of expertise to the ExcelDemy project. As a prolific contributor, he has authored around 180 articles, showcasing his deep knowledge and passion for Microsoft Excel, Data Analysis, and VBA. His unwavering commitment to continuous learning, combined with versatile skills, renders him well-suited for roles in data management and spreadsheet solutions. He has interest... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo