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

Lookup and Reference Examples

  • INDEX function: Description, Usage, Syntax, Examples and Explanation
  • How to get last column number in range in Excel
  • How to use Excel ROW Function
  • MATCH function: Description, Usage, Syntax, Examples and Explanation
  • Left Lookup in Excel

Data Analysis Examples

  • How to create Gauge Chart in Excel
  • How to count table columns in Excel
  • Excel Bar Chart
  • Conditional Formatting Rules in Excel
  • How to create Checklist in Excel

Data Validation Examples

  • Prevent invalid data entering in specific cells
  • Excel Data validation date in specific year
  • Excel Data validation unique values only
  • Excel Data validation must begin with
  • Excel Data validation must contain specific text

Excel Data validation unique values only

by

Reject duplicate data entry in a cell range.

To allow only unique values in a given range, you can use data validation with a custom formula based on the COUNTIF function.

Formula

=COUNTIF(range,A1)<2

Note: Cell references in data validation formulas are relative to the upper left cell in the range selected when the validation rule is defined, in this case B5.

Worked Example:   Count unique text values in a range in Excel

Explanation

In the example shown, the data validation applied to C5:C9 is:

=COUNTIF(emails,C5)<2

where emails is the named range C5:C9.

Worked Example:   Count occurrences in entire Excel Workbook

How this formula works

Data validation rules are triggered when a user adds or changes a cell value. In this example, we are using a formula that checks that the input doesn’t already exist in the named range “emails”:

COUNTIF(ids,B5)<2

COUNTIF returns a count of the value in C5 inside the named range emails (C5:C9). If the count is less than 2, the expression returns TRUE and validation succeeds. If not, the expression returns FALSE and validation fails.

Worked Example:   Count cells that contain negative numbers

Post navigation

Previous Post:

Excel Data validation specific characters only

Next Post:

Excel Data validation whole percentage only

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
  • SUBSTITUTE function: Description, Usage, Syntax, Examples and Explanation
  • How to get last word in a cell in Excel
  • How to count total characters in a range in Excel
  • Convert Numbers to Text in Excel
  • PROPER function: Description, Usage, Syntax, Examples and Explanation
  • Get fiscal year from date in Excel
  • How to calculate quarter from date in Excel
  • Basic timesheet formula with breaks in Excel
  • Convert Excel time to decimal minutes
  • Find Last Day of the Month in Excel
  • SYD function: Description, Usage, Syntax, Examples and Explanation
  • ISPMT function: Description, Usage, Syntax, Examples and Explanation
  • DISC function: Description, Usage, Syntax, Examples and Explanation
  • IRR function: Description, Usage, Syntax, Examples and Explanation
  • Calculate cumulative loan principal payments in Excel
© 2022 xlsoffice . All Right Reserved. | Teal Smiles