The fastest way to spot duplicates in Excel

Use the COUNTIF function to mark which values appear more than once in your data. This formula counts how many times each entry shows up in a column, and you can set it to flag anything that appears twice or more. The result is a new column that tells you instantly which rows contain duplicates — no manual scanning required.

The basic formula is =COUNTIF($A$2:$A$100,A2)>1, where A2:A100 is your data range and A2 is the cell you are checking. When the count is greater than 1, the formula returns TRUE (meaning a duplicate exists). When it returns FALSE, that value is unique.

This approach works for any column of data — names, email addresses, product codes, or numbers. You can also combine COUNTIF with other functions to find the first occurrence of a duplicate, highlight only the second copy, or count how many duplicates exist in total.

Key Takeaways

  • COUNTIF counts how many times a value appears in a range, and you can use it to flag any value that appears more than once.
  • The formula =COUNTIF($A$2:$A$100,A2)>1 returns TRUE for duplicates and FALSE for unique values, making it easy to filter or sort.
  • You can combine COUNTIF with MATCH to find only the second or later occurrence of a duplicate, leaving the first one unmarked.
  • Conditional formatting can color-code the results so duplicates stand out visually without needing a separate helper column.

Setting up the basic COUNTIF formula

Start by opening your spreadsheet and identifying the column that contains the values you want to check. Click on the first empty column next to your data — this is where your formula will go. In this example, your data is in column A (rows 2 through 100), so you would click on cell B2.

Type the formula =COUNTIF($A$2:$A$100,A2)>1 and press Enter. The dollar signs lock the range so it does not change when you copy the formula down. The formula checks how many times the value in A2 appears anywhere in the range A2:A100. If it appears more than once, the result is TRUE. If it appears only once, the result is FALSE.

Now copy this formula down to every row that contains data. Click on cell B2, then drag the small square at the bottom-right corner of the cell down to B100 (or however many rows you have). Excel will automatically adjust the second reference (A2, A3, A4, and so on) while keeping the range locked. You now have a column that shows TRUE next to every duplicate value and FALSE next to every unique value.

Finding only the second occurrence of a duplicate

If you want to mark only the second and later copies of a duplicate — leaving the first occurrence unmarked — use a different formula. This is useful when you want to keep one copy of each value and delete or flag only the extras.

Use =COUNTIF($A$2:A2,A2)>1 instead. This formula counts from the top of your range down to the current row only. The first time a value appears, the count is 1 (FALSE). The second time it appears, the count is 2 (TRUE). The third time, the count is 3 (TRUE), and so on. This way, only the duplicates after the first one are marked.

Copy this formula down the same way as before. Now you can sort by the TRUE values and delete them, knowing you are removing only the extra copies and keeping one instance of each value.

Counting how many times each value repeats

Instead of just TRUE or FALSE, you may want to see the actual count — how many times each value appears. Use the formula =COUNTIF($A$2:$A$100,A2) without the >1 comparison. This returns a number: 1 for unique values, 2 for values that appear twice, 3 for values that appear three times, and so on.

This is helpful when you need to know not just whether a duplicate exists, but how many copies there are. For example, if you are tracking customer orders and a customer ID appears 5 times, you know that customer has 5 orders. If it appears once, they have only one.

You can then filter or sort by this count column to group all the duplicates together, making it easier to review them or take action.

Using conditional formatting to highlight duplicates visually

Instead of adding a helper column with formulas, you can color-code duplicates directly in your original data. Select the column containing your values (for example, A2:A100), then go to the Home tab and click Conditional Formatting. Choose Highlight Cell Rules, then Duplicate Values. Excel will automatically color any value that appears more than once.

This method is faster if you just need to see which values are duplicated without needing to sort, filter, or delete them. The colors make duplicates stand out immediately, and you do not need to create a separate formula column.

If you want more control — for example, to highlight only the second occurrence or to use a specific color — you can use a custom formula instead. Go to Conditional Formatting, choose New Rule, then select Use a Formula to Determine Which Cells to Format. Enter =COUNTIF($A$2:A2,A2)>1 and choose your color. This gives you the same result as the helper column but applies the formatting directly to the cells.

Filtering your data to show only duplicates

Once you have a helper column showing TRUE or FALSE, you can filter to show only the duplicates. Click on any cell in your data range, then go to the Data tab and click Filter. Small dropdown arrows appear at the top of each column. Click the dropdown arrow in your helper column (the one with TRUE and FALSE), uncheck FALSE, and click OK. Now only the rows with duplicates are visible.

This is the fastest way to review all your duplicates at once. You can then copy them to another sheet, delete them, or make notes about which ones to keep. When you are done, click the filter dropdown again and select All to show all rows again.

If you did not create a helper column and used conditional formatting instead, you can still filter — but you will need to add a helper column first. The conditional formatting alone does not create a column you can filter by.

Handling duplicates across multiple columns

If you need to find duplicates based on a combination of values — for example, finding duplicate rows where both the first name and last name match — use a different approach. Create a helper column with the formula =COUNTIFS($A$2:$A$100,A2,$B$2:$B$100,B2)>1. This counts rows where the value in column A matches AND the value in column B matches.

COUNTIFS works the same way as COUNTIF but checks multiple criteria at once. You can add as many columns as you need: =COUNTIFS($A$2:$A$100,A2,$B$2:$B$100,B2,$C$2:$C$100,C2)>1 checks columns A, B, and C all together. This is useful for finding duplicate customer records where you need the full name and address to match, not just the name alone.

Frequently Asked Questions

What is the difference between COUNTIF and COUNTIFS?

COUNTIF checks one column for duplicates. COUNTIFS checks multiple columns at the same time. Use COUNTIF when you want to find duplicates in a single column, and COUNTIFS when you need to match values across two or more columns together.

Can I delete duplicates without using a formula?

Yes. Go to the Data tab and click Remove Duplicates. Excel will delete any row that is an exact duplicate of another row. However, this removes entire rows, not just duplicate values in one column. If you only want to remove duplicates from a specific column, use a formula first to identify them, then delete manually.

Why does my COUNTIF formula show the same result for every row?

You probably forgot the dollar signs in the range. The formula should be =COUNTIF($A$2:$A$100,A2)>1, not =COUNTIF(A2:A100,A2)>1. The dollar signs lock the range so it stays the same when you copy the formula down. Without them, the range shifts with each row and gives incorrect results.

How do I find duplicates in a column that has blank cells?

COUNTIF treats blank cells as values, so if you have multiple empty cells, they will be marked as duplicates. If you want to ignore blanks, use =COUNTIF($A$2:$A$100,A2)>1 but manually delete the TRUE result from the blank row, or use =IF(A2="","",COUNTIF($A$2:$A$100,A2)>1) to leave blanks unmarked.

Can I use this formula with text that has extra spaces?

COUNTIF is exact, so "John " (with a space) and "John" (without) are treated as different values. If your data has inconsistent spacing, use the TRIM function first: =COUNTIF($A$2:$A$100,TRIM(A2))>1. TRIM removes extra spaces before and after text, so duplicates with spacing differences will be caught.