• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microsoft Excel Tips and Tricks - Computergaga

  • Home
  • Excel Online Courses
  • Excel Functions List
  • Free Downloads
  • Blog
  • Tutorials
  • About
Home / Formulas / Prevent Duplicates in Excel

Prevent Duplicates in Excel

A common problem when using Excel is handling duplicate entries. I am often asked about removing or highlighting duplicates and common entries.

But prevention is better than the cure, so let’s look at how to prevent duplicates in Excel.

We can use the Data Validation tool with a formula to stop duplicates from being entered by the user. In this example we want to prevent duplicates from being entered into column A.

  1. Select the whole of column A by clicking the column header
  2. Click the Data tab on the Ribbon and click the Data Validation button
  3. Click the Allow: list arrow on the Settings tab and select Custom
Prevent duplicates in Excel
  1. Enter the following formula in the Formula box
=COUNTIF($A$1:$A1,$A1)=1

The COUNTIF function is used to count how many times the value just entered appears within column A.

Cell A1 is fixed to signify the start of the range, and the end of the range will automatically expand as more values are entered.

The Data Validation tool checks to see if the value has occurred only once. If it hasn’t then the entry will be prevented, and an error alert will be displayed to the user.

  1. Click the Error Alert tab. Type “Duplicate Entry” in the Title: box and “You have entered a duplicate entry.” in the Error message: box
Create an error alert in Data Validation
  1. Click Ok

Data Validation will prevent duplicates in Excel. If a duplicate value is entered the following error message will be displayed.

Error alert on duplicates in Excel

Related Posts:

  • Custom sort in Excel
    Custom Sort in Excel
  • N Functions in Excel thumbnail
    N Function in Excel
  • Moving average in Excel thumbnail
    Moving Average in Excel
  • Case sensitive XLOOKUP feature
    Case Sensitive Lookup with XLOOKUP in Excel

Reader Interactions

Comments

  1. Anjan Barua says

    27 September 2020 at 7:23 pm

    This is not applicable if Ctrl+D or copy paste is applied.

    Reply
    • Alan Murray says

      27 September 2020 at 8:01 pm

      This is true. Data Validation only prevents data on entry and is not perfect.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • Excel SWITCH Function – Nested IF Function Alternative
  • Sum Formulas Only in Excel
  • How to Calculate Age in Excel
  • Custom Sort in Excel
  • Case Sensitive Lookup with XLOOKUP in Excel
Advanced Excel Success book

Footer

Contact

[email protected]

LinkedIn Twitter YouTube

Useful Links

  • Home
  • Excel Online Courses
  • Tutorials
  • Sitemap
  • Privacy Policy
  • Jobs by Jooble

Course Topics

  • Blog
  • Charts
  • Courses
  • Dashboards
  • Downloads
  • Excel Tips
  • Formulas
  • Mail Merge
  • Office
  • PivotTables
  • Power BI
  • Power Pivot
  • Power Query
  • VBA

Join Our Mailing List

© Copyright 2009 Computergaga · All Rights Reserved ·