Tabellab

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 20 is free. Unlock all 20 hands-on labs, the final exam and your certificate.

Buy course — $9.90
Read first

In Excel: the Data Validation dialog

  • Select the input cells (e.g. B2:B9), then Data > Data Validation.
  • Settings tab: Allow = Whole number, Decimal, Date, Time, Text length, List or Custom; Data = between, greater than … ; Minimum/Maximum may point to cells such as =$B$13.
  • Input Message tab: a yellow tooltip that tells the user the rule before typing (e.g. “1 to 500 units”).
  • Error Alert tab: Stop blocks the entry, Warning and Information only warn. Write a helpful message: what is allowed, not just “Wrong”.
  • Already filled data? Data Validation > Circle Invalid Data draws red circles around existing entries that break the rule.

Custom rule = check formula

Under Allow: Custom you type a formula written for the top-left cell of your selection, e.g. =AND(B2=INT(B2),B2>=$B$13,B2<=$C$13) for B2:B9. Excel moves the relative B2 for every other cell, exactly like copying a formula down.

Loading the spreadsheet…

Why error-proof templates pay for themselves

Every company has the same spreadsheet story. A template goes out to ten people, and within a week someone types 12.5 boxes, someone else enters a price of 1,250 instead of 12.50, and a third person picks a delivery date in the past. Nobody notices until an invoice is wrong, a truck is booked for the wrong day or a total in a management report does not add up. Finding and fixing those errors later costs far more time than stopping them at the moment of entry.

That is what Data Validation in Excel is for: rules that decide which values a cell accepts. This free first lesson of the course shows how those rules really work, by writing them as plain check formulas that return TRUE for an allowed value and FALSE for a rejected one. It is written for anyone who builds or maintains templates that other people fill in: office and sales coordinators, controllers, team leads, project and HR staff. You need nothing beyond basic formulas. By the end you will write whole-number, decimal and date rules, understand why a rule is only a TRUE/FALSE test, and count every failed check in a single cell.

The examples use Larkspur Supply Co., a fictional wholesaler of packaging, cleaning and safety supplies, the same company as in the lab above. Its sales team types order lines with a quantity, a unit price and a delivery date into a shared template, and your job is to catch the bad entries.

The core idea: every rule is a TRUE/FALSE test

Open Data > Data Validation in Excel and the dialog offers friendly choices such as Whole number between 1 and 500. Behind each of them is a logical test. When a user types a value, Excel evaluates the test for that cell. If the result is TRUE, the value goes in. If it is FALSE, Excel shows the error alert. That is all a validation rule is, and once you see it that way, you can build any rule you like, because Allow: Custom accepts any formula that returns TRUE or FALSE.

Larkspur needs three rules for its order lines, with the limits kept in a small rule table so they are easy to change:

  • Quantity: a whole number between 1 (B13) and 500 (C13). Check formula: =AND(B2=INT(B2),B2>=$B$13,B2<=$C$13). INT rounds down to a whole number, so B2=INT(B2) is TRUE only when there is nothing after the decimal point.
  • Unit price: a decimal between 0.50 (B14) and 999.99 (C14), both limits included. Check formula: =AND(C2>=$B$14,C2<=$C$14).
  • Delivery date: on or after the order date in B15 and no later than 60 days after it. The last allowed date is calculated in C15 as =B15+B16, because Excel stores dates as day numbers and adding 60 means adding 60 days. Check formula: =AND(D2>=$B$15,D2<=$C$15).

AND is the glue. It returns TRUE only when every test inside it is TRUE, so one failed part is enough to reject the value. The dollar signs lock the limits: when you copy the formula from row 2 down to row 9, B2 becomes B3, B4 and so on, but $B$13 and $C$13 keep pointing at the rule table. Change 500 to 600 in one cell and every check updates.

Qty rule: whole number from 1 to 500 (peach = fails)allowed 1 to 50024L-01120L-02500L-0312.5L-040L-0536L-06640L-078L-08Date rule: from the order date to 60 days laterorder Nov 2 (B15)Jan 1 = B15+60 (C15)L-05 Oct 31L-07 Jan 16allowed rangeqty passesfails (12.5 is inside the band but not whole)
The quantity and date rules as allowed ranges. A value passes only when it lands inside the mint band and, for the quantity, is also a whole number; peach marks a failed check.

Worked example: checking Larkspur's eight order lines

The order date in this example is November 2, 2026, so the delivery window runs to January 1, 2027. The table shows the eight lines from the lab and the result of each check formula once it has been copied down. FALSE marks a value that Data Validation would have rejected.

LineQty (B)Unit price (C)Delivery (D)Qty OK (E)Price OK (F)Date OK (G)Why it fails
L-01244.75Nov 7, 2026TRUETRUETRUE
L-0212018.20Nov 16, 2026TRUETRUETRUE
L-035000.45Jan 1, 2027TRUEFALSETRUEPrice below 0.50 (500 and Jan 1 are exactly on the limits and pass)
L-0412.532.00Nov 5, 2026FALSETRUETRUENot a whole number
L-0509.99Oct 31, 2026FALSETRUEFALSEQty below 1, date before the order
L-06361,250.00Nov 23, 2026TRUEFALSETRUEPrice above 999.99
L-0764074.50Jan 16, 2027FALSETRUEFALSEQty above 500, date 75 days out
L-088999.99Dec 2, 2026TRUETRUETRUE999.99 is on the limit and passes
Failed checks in B18: =COUNTIF(E2:G9,FALSE)7

Two lines deserve a closer look. L-04 has 12.5 units, which sits comfortably between 1 and 500. A range test alone, =AND(B5>=$B$13,B5<=$C$13), would let it through. Only the extra B5=INT(B5) part catches it, because INT(12.5) is 12. L-06 has a unit price of 1,250.00, most likely 12.50 typed with a misplaced decimal point. A test that only checks the minimum would accept it, which is why both limits belong inside the AND.

The boundary values are just as instructive. L-03 orders exactly 500 units and L-08 charges exactly 999.99, and both pass, because >= and <= include the limit. Excel's own between option works the same way. If a business rule says "less than 500", you write < instead, and it is worth asking the person who owns the rule which one they mean before you build it.

Finally, =COUNTIF(E2:G9,FALSE) counts the FALSE results in all three check columns at once and returns 7. One number in one cell tells the sales manager whether the sheet is ready to process. If it is not 0, the matrix below shows exactly where to look.

The check columns E:G after copying the formulas downQty OKPrice OKDate OKL-01TRUETRUETRUEL-02TRUETRUETRUEL-03TRUEFALSETRUEL-04FALSETRUETRUEL-05FALSETRUEFALSEL-06TRUEFALSETRUEL-07FALSETRUEFALSEL-08TRUETRUETRUEFailed per ruleQty3Price2Date2COUNTIF(E2:G9,FALSE)= 7 failed checks5 of 8 lines fail at least one rule. L-05 and L-07 fail two rules each.
The check matrix for the eight order lines. Each peach cell is a value that a Data Validation rule would have stopped; COUNTIF adds them up.

Step by step: turning a check formula into a real Data Validation rule

  1. Select the input range for one field, for example the quantities in B2:B9. Make sure the first cell of the selection, B2, is the active cell (it is the white one).
  2. Open Data > Data Validation (Windows shortcut: Alt, A, V, V).
  3. On the Settings tab, choose Allow: Custom and enter the check formula written for the active cell: =AND(B2=INT(B2),B2>=$B$13,B2<=$C$13). Excel adjusts the relative B2 for every other cell, just like copying a formula down.
  4. For simple rules you can use the built-in options instead: Allow: Decimal, Data: between, Minimum =$B$14, Maximum =$C$14 for the price, or Allow: Date with Minimum =$B$15 and Maximum =$C$15 for the delivery date.
  5. Decide about Ignore blank. When it is ticked, an empty cell is always allowed, which is usually what you want while a form is being filled in.
  6. On the Input Message tab, write a short hint that appears when the cell is selected, such as "Whole units, 1 to 500".
  7. On the Error Alert tab, choose Stop to block invalid values, or Warning or Information to allow them after a prompt. Write a message that says what is allowed, not just that something is wrong.
  8. Click OK. To test existing data, open Data > Data Validation > Circle Invalid Data: Excel draws red circles around every value that breaks the rule. Clear Validation Circles removes them again.
Keep the check columns even after you add real Data Validation. They catch what the dialog cannot, and together with COUNTIF(...,FALSE) they give you a live error counter at the top of the template.

Why the check formula still matters when Data Validation is on

Data Validation is a gatekeeper for typing, and only for typing. It has three well-known blind spots. First, it checks a value only when it is entered by hand; values that were already in the cells when the rule was created are not re-checked. Second, a normal copy and paste replaces the destination cells' formatting and validation settings with those of the source, so a pasted value is not tested and the rule can disappear from those cells altogether. Third, cells whose values come from formulas or from macros are not validated at all. A check formula in a helper column has none of these gaps, because it simply recalculates whenever the data changes, however the data got there.

That is why this course teaches every rule twice: once as the formula you type under Allow: Custom, and once as a visible TRUE/FALSE column you can count, filter and highlight. You can even reuse the same formula for Conditional Formatting: select B2:B9, choose Home > Conditional Formatting > New Rule > Use a formula and enter =NOT(AND(B2=INT(B2),B2>=$B$13,B2<=$C$13)) with a light red fill. Invalid quantities then turn red no matter how they arrived.

To find every cell that already carries a validation rule in a workbook you inherited, use Home > Find & Select > Data Validation. To copy a rule to another range without its values, copy a validated cell and use Paste Special > Validation.

Designing the rule table

The small table in A12:C16 is the quiet hero of the template. Every limit lives in exactly one labelled cell, every check formula refers to it, and the person who owns the business rule can change it without touching a single formula. When the warehouse decides that orders above 500 units must go through a separate process, someone changes C13 and the template follows. When a new price list raises the cap, C14 changes. When the planning window grows from 60 to 90 days, only B16 changes, and C15 recalculates the last allowed date on its own.

Three habits keep such a table reliable. Give every limit a label in the column next to it, so nobody has to guess what 46,328 or 999.99 means. Format the cells to match their content, as a date, a currency amount or a whole number, so that a typo in the rule table is as visible as a typo in the data. And calculate derived limits, such as the last allowed date, with a formula rather than typing them, so two cells can never disagree. In lesson 8 you will lock this table with sheet protection, so that users can fill in the order lines but cannot loosen the rules.

Common mistakes and how to spot them

  • Testing only one limit. =C7>=$B$14 accepts 1,250.00. Every range rule needs both a lower and an upper test inside AND.
  • Forgetting the whole-number part. A range test lets 12.5 units through. Add B2=INT(B2), or use Allow: Whole number in the dialog.
  • Typing limits into the formula. =AND(B2>=1,B2<=500) works today, but when the limit changes someone has to edit every rule. Keep limits in labelled cells and lock the references with F4.
  • Missing dollar signs. Without $, the limits slide down when the formula is copied and later rows compare against empty cells. Symptom: rows near the top behave, rows further down all fail or all pass.
  • Writing the custom formula for the wrong cell. The formula must be written for the active cell of your selection. If you selected B2:B9 but wrote the formula for B3, every cell checks the value one row below it.
  • Counting TRUE instead of FALSE. =COUNTIF(E2:G9,TRUE) returns the passed checks (17 here). For the error counter you need FALSE.
  • Treating blanks by accident. In a check column, an empty quantity counts as 0 and fails the rule. If blanks are allowed, write =OR(B2="",AND(...)) so empty rows do not inflate the error count.
  • Relying on Stop alerts alone. As explained above, pasting bypasses them. Use Circle Invalid Data or a check column before you trust the data.

Excel Data Validation and error-proof templates course cover: rule checks on an order entry template
Excel Data Validation & Error-Proof Templates: 20 labs on one fictional wholesaler's order, customer, invoice and expense templates.

Quick reference: functions, menus and shortcuts

Function, menu or keyWhat it doesExample from the lab
ANDTRUE only when every test is TRUE=AND(C2>=$B$14,C2<=$C$14)
INTRounds down to a whole number; B2=INT(B2) tests for whole numbers=INT(12.5) returns 12
ORTRUE when at least one test is TRUE=OR(B2="",B2>=1)
NOTReverses TRUE and FALSE, useful for highlighting invalid cells=NOT(AND(...))
COUNTIFCounts cells that equal a value, here FALSE=COUNTIF(E2:G9,FALSE) returns 7
Date + numberAdds days to a date=B15+B16 returns Jan 1, 2027
Data > Data ValidationCreate a rule (Alt, A, V, V on Windows)Allow: Custom
Circle Invalid DataMarks existing values that break a ruleData > Data Validation drop-down
F4Toggles absolute and relative referencesLock $B$13
Find & Select > Data ValidationSelects all cells that have a ruleAudit an inherited template

Real-world uses

  • Order and quotation templates: quantities in whole units within a sensible maximum, prices within a plausible range, delivery dates within the planning window, exactly like Larkspur's order lines.
  • Timesheets: hours per day between 0 and, for example, 12, in steps that match your policy, and dates that fall inside the current pay period.
  • Expense claims: amounts above zero and below an approval limit, receipt dates not in the future and not older than the claim period your company allows.
  • Budget and forecast inputs: percentages between 0 and 1, growth rates within an agreed band, and a visible error counter before the file is consolidated.
  • Data imports: before loading a list into an accounting or ERP system, check columns and one COUNTIF tell you whether every row meets the target system's rules.

What you will build in the rest of this course

The seven paid lessons stay with Larkspur Supply Co. and cover every kind of rule a real template needs, ending with a template you could hand to a whole team. Each lab checks every cell you fill in instantly.

List Rules: Allowed Values with COUNTIF & MATCH. You check each order's region and payment terms against the allowed lists, which is the logic behind every drop-down list, and count the bad and the clean orders.

Dependent Lists: Category → Item with INDEX/MATCH. You make sure every item belongs to its category, the logic of a cascading drop-down, and build the INDEX/MATCH pieces that feed its list source.

Text Length & Pattern Checks: LEN, LEFT, SEARCH. You test new customer records for a valid ID pattern, a plausible email and a sensible name length, and count the records that are ready to import.

Duplicate Prevention: COUNTIF & COUNTIFS Rules. You build the rules that stop the same supplier invoice from being paid twice, including a rule that blocks only the repeat entry.

Cross-Field Rules: End ≥ Start and Shares = 100%. You validate a project budget where one cell depends on another: end dates after start dates and cost shares that add up to exactly 100%.

Input Form with Error Messages & an Error Summary. You finish an expense-claim form with rule checks, a looked-up category limit, an error count and red highlighting for every invalid field.

Template Protection Checklist & Completeness Dashboard. You measure how complete the submitted forms are, chart it for the sales manager and work through the protection checklist that makes a template ready to roll out.

Summary

A Data Validation rule is a TRUE/FALSE test. Write it as a check formula with AND, keep the limits in cells locked with $, add B2=INT(B2) when only whole numbers are allowed, and remember that >= and <= include the limits. The same formula goes into Allow: Custom, and as a visible check column it also catches pasted values that the dialog misses. =COUNTIF(E2:G9,FALSE) turns the whole sheet into one error count. Now scroll up to the lab, write the three rules for Larkspur's order lines and let the Coach check your work. It takes about fifteen minutes.

Frequently asked questions

How do I allow only whole numbers in an Excel cell?

Use Data > Data Validation with Allow: Whole number and set the minimum and maximum. As a custom formula, =AND(B2=INT(B2),B2>=1,B2<=500) does the same and also works as a check column.

Does Data Validation work when values are pasted?

No. A normal paste replaces the target cells' validation with that of the source, and the pasted values are not checked. Use Circle Invalid Data or a check formula column to catch them.

How do I restrict a date to a range in Excel?

Choose Allow: Date with Data: between and point Minimum and Maximum to cells, for example =$B$15 and =$B$15+60. The custom formula =AND(D2>=$B$15,D2<=$C$15) is the equivalent check.

Is the between option in Data Validation inclusive?

Yes. Between allows both the minimum and the maximum value. If a value must be strictly below a limit, use less than or a custom formula with <.

How do I find existing invalid entries after adding a rule?

Open the Data Validation drop-down on the Data tab and choose Circle Invalid Data. Excel circles every value that breaks the rule, and Clear Validation Circles removes the marks.

How can I count all validation errors in a sheet?

Put one TRUE/FALSE check formula per rule in helper columns and count the failures with =COUNTIF(E2:G9,FALSE). The result is a single error counter for the whole template.

Keep going: Excel Data Validation & Error-Proof Templates

This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time $9.90.

  1. List Rules: Allowed Values with COUNTIF & MATCH
  2. Dependent Lists: Category → Item with INDEX/MATCH
  3. Text Length & Pattern Checks: LEN, LEFT, SEARCH
  4. Duplicate Prevention: COUNTIF & COUNTIFS Rules
  5. Cross-Field Rules: End ≥ Start and Shares = 100%
  6. Input Form with Error Messages & an Error Summary
  7. Template Protection Checklist & Completeness Dashboard
  8. Data Type Checks: Numbers Stored as Text, Blanks vs Zeros
  9. Check Digits: Catching Typos in Article Codes with MID & MOD
  10. Hidden Spaces & Case Traps: TRIM, PROPER & EXACT Before the Check
  11. Plausibility Rules: Price Tolerances & Unusual Quantities
  12. Conditional Required Fields: Rules That Apply Only Sometimes
  13. Delivery Date Rules: Weekdays, Closed Days & Minimum Lead Time
  14. Error Matrix: Errors per Line, First Error & Failures per Rule
  15. Master-Data Rules: Active Customers & Credit Limits Across a Batch
  16. Severity Levels: Errors vs Warnings & a Pass / Hold / Reject Status
  17. Sequence Checks: Missing Numbers & Duplicates in Delivery Notes
  18. Error-Rate Tracking: Weekly Rate, Rolling Rate & Target Chart
  19. Final Project: Order-Entry Template with a Quality Dashboard

Buy course — $9.90 See the full course