Ravindra BagaleCourses & study guides मराठी Track your progress

2. Data Entry Tools

2.3 Data Validation

Data Validation (custom rule) with example — in 30 seconds

What: Data Validation stops wrong values at the moment of typing.

Why: A wrong Order ID typed today breaks lookups next month. Stopping it at entry is cheaper than cleaning later.

Tiny example: Order IDs must start with BLK or AMN. "XYZ-1013" is rejected with an error message.

First look at the data (before → after):

Data Validation (custom rule) with example: before and after tables, fictional FreshGo Maharashtra data

Expected result — What Excel does

Typed value Result
BLK-1011 Accepted
AMN-1012 Accepted
XYZ-1013 Rejected (error alert)
1014 Rejected (error alert)

About this data: Teaching sample for a fictional shop “NovaCraft Tools”. Figures and names (e.g. Neha Shah) are made up for this lesson on data validation.

Before table and formula as text

Before — What people try to type in column A

Typed value First 3 letters
BLK-1011 BLK
AMN-1012 AMN
XYZ-1013 XYZ
1014 101

About this data: Demo table only — not real customer or company data. Built to practise data validation.

Formula / click path

Data › Data Validation › Allow: Custom
Formula: =OR(LEFT(A2,3)="BLK",LEFT(A2,3)="AMN")

Do it step by step:

  1. Select A2:A5000, starting from A2.
  2. Click Data › Data Validation.
  3. In Allow, choose Custom.
  4. In Formula, type =OR(LEFT(A2,3)="BLK",LEFT(A2,3)="AMN").
  5. Open the Error Alert tab and write a short message, for example "Order ID must start with BLK or AMN".
  6. Click OK and test with XYZ-1013.

Data validation restricts what can be typed in a cell, and shows a message when someone types a wrong value.

Steps in Excel

  1. Select the cells (e.g. Qty column I2:I1000).
  2. Data › Data Tools › Data Validation.
  3. Settings tab › Allow: Whole number › Data: between › Minimum 1 › Maximum 20.
  4. Input Message tab › Title Qty › Message Enter 1 to 20 units.
  5. Error Alert tab › Style: Stop (blocks), Warning (asks), or Information (only informs) › Title and message › OK.
  6. To find old wrong values: Data › Data Tools › Data Validation ▾ › Circle Invalid Data.
Allow Example rule on our data
Whole number Qty between 1 and 20
Decimal Unit Price > 0
List Status = Delivered, Cancelled, Returned
Date Order Date between 01-04-2026 and 31-03-2027 (financial year)
Time Order time between 06:00 and 23:59
Text length Pincode length = 6
Custom Order ID must start with BLK or AMN: =OR(LEFT(A2,3)="BLK",LEFT(A2,3)="AMN")

About this data: Made-up rows so you can copy the pattern for data validation. Currencies may use ₹, £, € or $.

Worked example – no duplicate Order IDs. Select A2:A5000 › Data Validation › Allow: Custom › Formula:

=COUNTIF($A$2:$A$5000,A2)=1

Now if Raja types an Order ID that already exists, Excel stops him.

Ravindra Bagale's Tip

Many students apply data validation and think that wrong values can no longer come in. But copy-paste overwrites the validation, and old wrong values stay as they are. After applying validation, run Circle Invalid Data, and when you need to paste, use Paste Special › Values.

Practice task

Add validation to your Orders sheet: Qty 1–20 (Stop), Order Date within FY 2026-27 (Warning), and a 6-digit pincode (text length = 6) with a friendly input message.

Loading practice tasks...

  1. Pass or fail (Easy): "Pass" if B2 is at least 40, else "Fail".
  2. Total (Easy): B2 plus C2.
  3. Passed score 1 (Easy): How many in B2:B11 are 40 or more?
  4. Passed both (Medium): TRUE if B3 and C3 are both at least 40.
  5. Passed either (Medium): TRUE if B4 or C4 is at least 75.
  6. Grade (Medium): Grade for the average of B2:C2: "A" 75+, "B" 60+, "C" 40+, else "F".
  7. Eligible (Medium): "Eligible" if D5 is at least 75 and B5 at least 40, else "Not eligible".
  8. Count passed both (Hard): How many have both scores at least 40?
  9. Pass percentage (Hard): Share passing score 1, rounded to 2 decimals.
  10. Nested IF band (Hard): "High" if C6 ≥ 75, "Mid" if ≥ 50, else "Low", using nested IF.
  11. Top scorer (Hard): Name with the highest score 1.

Quick revision cards

Three standalone cards. Each one explains the idea with its own example. Scan the QR to open this lesson.

Revision card 1: What is Data Validation?
Card 1: What is Data Validation? · Download PNG
Revision card 2: Tiny example — Data Validation
Card 2: Tiny example — Data Validation · Download PNG
Revision card 3: Checklist — Data Validation
Card 3: Checklist — Data Validation · Download PNG