Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Flag Duplicates in Excel: Step-by-Step Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To flag duplicates in Excel, select your data range and use Conditional Formatting > Highlight Cells Rules > Duplicate Values. This instantly colours every repeated entry so you can spot them at a glance. For a more permanent marker, add a helper column with a COUNTIF formula that returns "Duplicate" or "Unique" for each row. Both methods work in Excel for Microsoft 365, Excel 2021, 2019, and 2016 on Windows and Mac; the exact menu labels can differ slightly by version and region.

What You'll Need

  • Excel for Microsoft 365, Excel 2021, 2019, or 2016 (Windows or Mac). The steps also work in Excel for the web, though the ribbon layout is slightly different.
  • A worksheet with data organised in columns, ideally with a header row.
  • Basic familiarity with selecting cells and typing formulas.

Step-by-Step

  1. Select the range you want to check. Click the first cell of your data and drag to the last, or press Ctrl+A (Windows) / Command+A (Mac) to select the whole used range. If your data has headers, include them only if you plan to use the formula method; for Conditional Formatting, exclude headers to avoid flagging the header text itself.
  2. Open Conditional Formatting. On the Home tab, click Conditional Formatting > Highlight Cells Rules > Duplicate Values. (In Excel for the web, the path is Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values.)
  3. Choose a format. In the dialog box, pick a preset like Light Red Fill with Dark Red Text, or choose Custom Format to set your own fill colour. Click OK. Every duplicate value in the selected range is now highlighted.
  4. Review the highlights. Scroll through your data. Conditional Formatting flags every occurrence of a repeated value, including the first one, so you see all copies, not just the second onward.
  5. (Optional) Flag duplicates with a formula. If you want a text label you can filter or sort by, insert a new column next to your data. In the first data row (say row 2), type: =IF(COUNTIF($A$2:$A$100,A2)>1,"Duplicate","Unique"). Replace $A$2:$A$100 with the actual range of the column you are checking, and A2 with the first cell of that column. Press Enter and fill the formula down to the last row. This marks every row whose value appears more than once.
  6. (Optional) Flag only the second and later occurrences. Use this formula instead: =IF(COUNTIF($A$2:A2,A2)>1,"Duplicate",""). The expanding range $A$2:A2 counts only rows up to the current one, so the first occurrence stays blank and later copies are labelled.
  7. Filter or sort by the flag. Turn on Filter (Data > Filter), then use the drop-down in your helper column to show only "Duplicate" rows. You can then delete, move, or review them as needed.
  8. Remove the formatting or helper column when done. To clear highlights, select the range and go to Conditional Formatting > Clear Rules > Clear Rules from Selected Cells. To remove the helper column, right-click its header and choose Delete.

Common Mistakes

  • Selecting only part of the data. Conditional Formatting applies only to the cells you selected. If you miss rows, duplicates outside the selection stay unflagged.
  • Including the header row. If the header text appears only once, it will not be flagged, but if you have a header like "Name" and a data value "Name", both get highlighted. Exclude headers for cleaner results.
  • Expecting the formula to delete rows. The COUNTIF method only labels; it does not remove anything. You still need to filter and delete manually, or use Data > Remove Duplicates (which permanently deletes rows, so make a copy first).
  • Forgetting absolute references. In the COUNTIF range, use dollar signs (e.g., $A$2:$A$100) so the range does not shift when you fill the formula down.
  • Assuming duplicates are identical across all columns. Conditional Formatting checks only the selected cells. To flag rows that are duplicates across multiple columns, select all relevant columns before applying the rule, or use a formula that concatenates the columns.

Tips

  • Use a distinct fill colour (e.g., bright yellow) for duplicates so they stand out against your normal formatting.
  • To flag duplicates across multiple columns as a single record, select the entire table (excluding headers) before applying Conditional Formatting. Excel will highlight cells that repeat within the selection, which may flag partial matches; for exact row duplicates, use a helper column with =COUNTIFS(range1,criteria1,range2,criteria2,...)>1.
  • If you only want to flag duplicates in one column but keep the rest of the row visible, apply the rule to that column only.
  • Combine Conditional Formatting with a filter: filter by colour (Data > Filter > Filter by Color) to show only highlighted cells.
  • For large datasets, the formula method is often faster to scan and can be sorted.

Troubleshooting

  • No cells are highlighted. Check that you selected the correct range and that the values are truly identical. Extra spaces or different case can make values appear different; use TRIM and LOWER in a helper column to normalise before checking.
  • Everything is highlighted. You may have selected a range where every value is repeated (e.g., a column of the same date). Verify your selection and the rule settings.
  • The formula returns #VALUE! or #NAME?. Ensure you typed the function names correctly and that the range references are valid. In some locales, the formula separator may be a semicolon instead of a comma.
  • Conditional Formatting does not update when data changes. It should update automatically. If not, press F9 to recalculate, or check that Calculation Options is set to Automatic (Formulas > Calculation Options).
  • You accidentally deleted rows with Remove Duplicates. Undo immediately with Ctrl+Z (Windows) or Command+Z (Mac). Remove Duplicates permanently deletes rows, so always work on a copy.

Frequently Asked Questions

Can I flag duplicates without changing the cell values?

Yes. Conditional Formatting only changes the appearance, not the underlying data. The helper column method adds a new column but leaves your original data untouched.

Does Conditional Formatting work on multiple columns at once?

Yes, if you select multiple columns, Excel highlights any cell whose value appears more than once within the entire selection. This can flag partial matches across columns, so use it carefully.

How do I flag duplicates in a single column only?

Select just that column (excluding the header) before applying Conditional Formatting, or use a COUNTIF formula that references only that column.

What is the difference between flagging and removing duplicates?

Flagging highlights or labels duplicates so you can review them. Removing duplicates (Data > Remove Duplicates) permanently deletes rows, keeping only the first occurrence. Always back up your data before removing.

Can I flag duplicates in Excel for the web?

Yes, Conditional Formatting is available in Excel for the web with the same menu path. The formula method also works, though some advanced functions may be limited.

Why are some duplicates not highlighted?

Check for leading or trailing spaces, non-printing characters, or differences in case. Use TRIM and CLEAN functions in a helper column to standardise values before checking.