Skip to content
xlsoffice. All Rights Reserved
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Lookup and Reference Examples

  • How to get relative row numbers in a range in Excel
  • How to use Excel COLUMN Function
  • How to use Excel TRANSPOSE Function
  • How to create dynamic named range with OFFSET in Excel
  • How to get last column number in range in Excel

Data Analysis Examples

  • How to Create Gantt Chart in Excel
  • How to Create Thermometer Chart in Excel
  • How To Perform and Interpret Regression Analysis in Excel
  • Understanding Pivot Tables in Excel
  • Example of COUNTIFS with variable table column in Excel

Data Validation Examples

  • Excel Data validation whole percentage only
  • Excel Data validation specific characters only
  • Data validation must not exist in list
  • Excel Data validation must begin with
  • Excel Data validation date in next 30 days

Prevent Duplicate Entries in Excel

by

This example teaches you how to use data validation to prevent users from entering duplicate values.

1. Select the range A2:A20.

2. On the Data tab, in the Data Tools group, click Data Validation.

3. In the Allow list, click Custom.

4. In the Formula box, enter the formula shown below and click OK.

Explanation: The COUNTIF function takes two arguments. =COUNTIF($A$2:$A$20,A2) counts the number of values in the range A2:A20 that are equal to the value in cell A2. This value may only occur once (=1) since we don’t want duplicate entries. Because we selected the range A2:A20 before we clicked on Data Validation, Excelautomatically copies the formula to the other cells. Notice how we created an absolute reference ($A$2:$A$20) to fix this reference.

5. To check this, select cell A3 and click Data Validation.

As you can see, this function counts the number of values in the range A2:A20 that are equal to the value in cell A3. Again, this value may only occur once (=1) since we don’t want duplicate entries.

6. Enter a duplicate invoice number.

Result. Excel shows an error alert. You’ve already entered that invoice number.

 

Note: to enter an input message and error alert message, go to the Input Message and Error Alert tab.

Post navigation

Previous Post:

Prevent invalid Product Codes or ID Numbers in Excel

Next Post:

Reject Invalid Dates in Excel

Leave a Reply Cancel reply

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

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others
  • How to extract nth word from text string in excel
  • How to strip html from text or numbers in Excel
  • SUBSTITUTE function vs REPLACE function in Excel
  • How to extract domain from email address in Excel
  • Change Case: Uppercase, Lowercase, Propercase in Excel
  • Display Days until expiration date in Excel
  • DAY function: Description, Usage, Syntax, Examples and Explanation
  • Get day name from date in Excel
  • Count dates in current month in Excel
  • Display Days in month in Excel
  • PRICEDISC function: Description, Usage, Syntax, Examples and Explanation
  • XNPV function: Description, Usage, Syntax, Examples and Explanation
  • SLN function: Description, Usage, Syntax, Examples and Explanation
  • IPMT function: Description, Usage, Syntax, Examples and Explanation
  • NOMINAL function: Description, Usage, Syntax, Examples and Explanation
© 2022 xlsoffice . All Right Reserved. | Teal Smiles