Data Validation in Excel

Learn how to use Data Validation in Excel to control data entry and avoid errors. From dropdowns to custom rules, this guide covers it all with examples.

Data Validation in Excel is a powerful feature that helps ensure the accuracy and consistency of data entered into your spreadsheets. By setting rules for what users can or cannot enter, you reduce the chance of mistakes and make your sheets more efficient.

In this post, you’ll learn:

  • What is Data Validation
  • How to create dropdown lists
  • Custom rules using formulas
  • Restrict numbers, dates, and text
  • Real-life examples using a Sales table
  • Tips, FAQs, and more

We’ll use the same Sales Table as reference:

Bill DateBill No.Customer NameLocationProductQtySales Amount
01/01/2024INV0030Yuvraj NairKorbaSuit613991
02/01/2024INV0033Yuvraj NairRajnandgaonT-Shirt964800
02/01/2024INV0081Yuvraj NairGariabandT-Shirt328467
03/01/2024INV0020Vivek MalhotraBalodSuit641580
04/01/2024INV0058Vivaan SharmaSargujaKurta446670

Basic Data Validation Types

1. Create a Dropdown List

Example: Allow only specific product names.

  • Select cells in the “Product” column. (e.g. K2)
  • Go to Data > Data Validation (Under the Data Tools section).
  • In “Allow”, choose List.
  • In “Source”, enter: Suit, T-Shirt, Kurta, Hoodie, Blazer (Or select Range from Excel Sheet)
  • Select cell K2, then drag down to the last row of your data. After selecting, press Ctrl + D to apply (fill down) the Data Validation rule to all selected cells.
Dropdown using Data Validation in Excel
Data > Data Validation > Allow (List) > Source (Type data/Select range) > OK

Read More: Conditional Formatting in Excel

2. Restrict to Whole Numbers Only

Example: Allow Qty only between 1 and 20.

  • Select “Qty” column (e.g. L2).
  • Choose Allow: Whole Number > Between 1 and 20.
Allow Whole number between 1 to 20 - Data Validation in Excel

3. Limit Date Range

Example: Restrict to order dates within the current year. (Created New Column i.e. Bill Date)

  • Allow: Date > Between > 01/01/2024 and 31/12/2024 (Format: DD/MM/YYYY)
Limit date between give range

4. Text Length Restriction

Example: Limit customer names to 20 characters max.

  • Allow: Text Length > less than or equal to > 20
Limit Text Length in Excel
Note: Data: = less than or equal to

Advanced Data Validation with Formula

5. Custom Formula – No Duplicate Bill Nos

Prevent users from entering a duplicate Bill No:

=COUNTIF($J$2:$J$113, J2)=1

Custom formula in Data Validation in Excel

6. Product Must Match Location

Example: Only allow “T-Shirt” if Location is “Gariaband”

=IF(M2=”T-Shirt”, L2=”Gariaband”, TRUE)

It means:

If the product is “T-Shirt”, then it must be from “Gariaband” — only then the entry will be allowed.

So:

  • A customer from Gariaband can buy T-Shirt
  • A customer from other locations cannot buy T-Shirt
  • For all other products, any location is allowed ✅

7. Total Sales Must Be ≥ 5000

Apply in “Sales Amount” column:

=O2>=5000


Example 8: Restrict Product Entry Based on Customer’s Previous Purchases

Scenario:
You want to allow entry of “Blazer” for a customer only if they’ve already bought a Kurta before. This ensures upselling happens only after basic product sale.

How to Apply:

  1. Add a helper table that tracks past customer purchases (or use the main table).
  2. Use this formula in the Product column (e.g., cell M2):

=IF(M2="Blazer", COUNTIFS($K$2:$K$113, K2, $M$2:$M$113, "Kurta")>0, TRUE)

Explanation:
This checks whether the current customer (K2) has “Kurta” as a previous entry. If yes, they are allowed to enter “Blazer”. If not, validation fails.

Real-Life Use Cases

  • Sales team dropdowns for consistent product names
  • Prevent entering future dates in invoice systems
  • Stop entry of too-long names/emails in customer forms
  • Block duplicate invoice numbers

Error Alerts & Input Messages

Show Helpful Tips When User Clicks Cell

  • In Data Validation, go to Input Message tab
  • Add message like: “Choose a product from the list”

Show Warning or Stop Entry

  • Under Error Alert tab:
    • Style: Stop, Warning, or Information
    • Customize message: “Qty must be between 1 and 20”

How to Remove Data Validation

  • Select cells or a column (where data validation applied)
  • Go to Data > Data Validation > Clear All
Clear Data Validation in Excel
Click on “Clear All

Download Practice Material


Summary

Data Validation helps control the kind of data that can be entered into Excel cells. Whether you’re preventing typos or ensuring business logic, this tool is a must-have for data quality.


FAQs – Data Validation in Excel

Only one rule at a time, but formulas can be made complex to handle multiple conditions.

Yes! It’s recommended for dynamic dropdowns.

Basic features work, but formula-based validations may have limitations.

What’s Next?

In the next post, we’ll learn about the Freeze Panes in Excel

Spread the love

Leave a Comment

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

Translate »
Scroll to Top