Data Validation is the tool that transforms an ordinary spreadsheet into a controlled data entry form. Instead of trusting users to type the correct values, you define exactly what is allowed in each cell: a list of options (so users pick instead of type), a number within a range, a date within specific bounds, a text length limit, or a custom formula rule. Combine this with meaningful error messages and input hints, and you eliminate the most common data quality problems before they happen. Drop-down lists are the most visible application — they are found in every professional SA Excel template from payroll systems to inventory forms to leave trackers.
Data Validation restricts what a user can enter into a cell. You define a rule; when the user tries to enter something that violates the rule, Excel either alerts them, warns them, or silently accepts it depending on the alert type you choose.
| Tab | What It Does |
|---|---|
| Settings | Defines the rule: what type of data is allowed and what criteria it must meet |
| Input Message | Optional tooltip that appears when the cell is selected — guides the user before they type |
| Error Alert | Controls what happens when invalid data is entered — Stop (blocks entry), Warning (allows with a caution), or Information (informs but always allows) |
The Allow dropdown on the Settings tab determines the category of validation rule. Each type reveals its own set of criteria options.
| Allow Type | Criteria Options | SA Use Case |
|---|---|---|
| Any value | No restriction (default) — but can still have an Input Message | Free-text cells with a helpful tooltip but no restriction |
| Whole number | Between, not between, equal to, not equal to, greater than, less than, greater than or equal to, less than or equal to — set minimum and/or maximum | Leave days (1–30), age (18–65), quantity (0–9999), employee number (1–99999) |
| Decimal | Same criteria as Whole number but allows decimal values | Commission rate (0.00–0.30), salary (5000–500000), percentage (0–100) |
| List | A comma-separated list typed directly, or a range of cells containing the list values | Province, department, job title, status, product category — any fixed set of options |
| Date | Between dates, before/after a date, equal to a specific date — can reference cells or use TODAY() | Date of birth (before today), contract start date (after 01/01/2020), invoice date (within current year) |
| Time | Between, before, or after a time value | Shift start time (06:00–22:00), meeting booking (08:00–17:00) |
| Text length | Between, equal to, greater than, or less than a number of characters | SA ID number (exactly 13 characters), postal code (4 digits), SARS tax number (10 digits) |
| Custom | Any Excel formula that returns TRUE (valid) or FALSE (invalid). The most powerful and flexible validation type. | Unique values only, conditional rules, cross-cell validation, regex-like checks |
At the bottom of the Settings tab: Ignore blank — when ticked, blank cells pass validation without triggering an error. Untick if the field is mandatory and must not be left empty.
Tick "Apply these changes to all other cells with the same settings" to update every cell in the sheet that currently has the same validation rule — useful for updating a rule without reapplying it to each range individually.
A drop-down list (List validation) is the most commonly used data validation type. Instead of typing, users click the dropdown arrow and select from a predefined list of options — eliminating spelling variations, capitalisation inconsistencies, and invalid entries.
Gauteng,Western Cape,KwaZulu-Natal,Eastern Cape,Limpopo)=$J$2:$J$11)Provinces) → Enter=ProvincesA static range-based list does not include new items added below the named range. A dynamic list automatically expands as you add items.
=ProvinceTable[Province] (using the Table name and column header)A dependent dropdown changes its options based on the selection in another cell. Example: selecting a Province in column A changes the available Cities in column B to show only cities in that province.
=INDIRECT(A2)=INDIRECT(SUBSTITUTE(A2," ","_"))An Input Message is a small tooltip that appears automatically when a user clicks a validated cell — before they enter any data. It is the most effective way to communicate instructions, acceptable formats, or examples directly in the spreadsheet.
| Cell Type | Title | Message |
|---|---|---|
| SA ID Number | SA ID Number | Enter 13 digits. Example: 9001155009087. No spaces or hyphens. |
| Salary | Monthly Salary (Rand) | Enter gross monthly salary in Rands. Must be between R4,500 and R500,000. |
| Leave start date | Leave Start Date | Enter in dd/mm/yyyy format. Date must be in the future. |
| Province dropdown | Province | Select the employee's province of residence from the list. |
The Error Alert tab controls what happens when a user enters data that violates the validation rule. There are three styles, each with a different level of strictness.
| Style | Icon | Effect | When to Use |
|---|---|---|---|
| Stop | 🛑 Red stop sign | Completely blocks invalid entry — the user must enter a valid value or cancel. The invalid value is never accepted. | Mandatory fields that must be correct: SA ID, employee number, amounts within a required range |
| Warning | ⚠️ Yellow triangle | Shows a warning but allows the user to override by clicking "Yes" to continue anyway | Fields where an unusual value is possible but worth flagging: an exceptionally high salary, a date far in the future |
| Information | ℹ️ Blue info circle | Shows a message but always accepts the entry — the user is informed but not blocked | Soft guidance where the value entered is outside the expected range but not necessarily wrong |
| Validation | Style | Title | Message |
|---|---|---|---|
| ID number (exactly 13 chars) | Stop | Invalid ID Number | SA ID numbers must be exactly 13 digits. Please re-enter. |
| Salary > R200,000/month | Warning | Unusual Salary | The salary entered exceeds R200,000/month. Please verify this is correct. Click Yes to proceed. |
| Leave days > 30 | Stop | Leave Days Exceeded | Maximum leave per request is 30 days. Please enter a value between 1 and 30. |
| Contract end before start | Stop | Invalid Date | End date cannot be before start date. Please check the dates. |
Custom validation allows any Excel formula that returns TRUE or FALSE. If the formula returns TRUE, the entry is valid; FALSE triggers the error alert. This is the most powerful validation type, enabling cross-cell rules and complex data integrity checks.
Like Conditional Formatting formulas, the formula is written for the top-left cell of the selected range and applies relatively to all other cells. Use column-locked references ($A2) when the rule depends on a column; use fully absolute references ($A$1) for a fixed reference cell.
| Rule | Formula (for cell B2) | How It Works |
|---|---|---|
| SA ID exactly 13 digits | =LEN(B2)=13 |
TRUE if the entry is exactly 13 characters long |
| No duplicates in a column | =COUNTIF($B$2:$B$200,B2)=1 |
TRUE if the value appears only once in the range — blocks entry of a value already in the list |
| End date must be after start date | =C2>$B2 (end date in C2, start in B2) |
Cross-cell rule: C2 must be greater than B2 |
| Email contains @ and . | =AND(ISNUMBER(FIND("@",B2)),ISNUMBER(FIND(".",B2))) |
TRUE if the cell contains both @ and . characters (basic email format check) |
| SA phone number (10 digits starting with 0) | =AND(LEN(B2)=10,LEFT(B2,1)="0") |
TRUE if exactly 10 characters AND starts with "0" |
| Percentage between 0 and 100 | =AND(B2>=0,B2<=100) |
TRUE if the value is 0 or above AND 100 or below |
| Cell must not be blank (mandatory field) | =B2<>"" |
TRUE if the cell is not empty (prevents blank submission) |
| Numeric only (no text) | =ISNUMBER(B2) |
TRUE if the cell contains a number; FALSE for text |
| Date in the current year | =YEAR(B2)=YEAR(TODAY()) |
TRUE if the entered date falls within the current calendar year |
| Value from approved list (dynamic) | =COUNTIF(ApprovedList,B2)>0 |
TRUE if the entered value exists in the named range "ApprovedList" — more flexible than dropdown List type |
Excel can visually identify cells that already contain data violating the current validation rules (data entered before the rule was applied, or rules added after data was entered):
Q1: You want a Province dropdown in column C of a data entry form. The provinces are already listed in column A of a hidden "Lists" sheet (A2:A9). Write the Data Validation setup steps and the Source value to use.
✓ Select all cells in the Province column (e.g., C2:C200) → Data → Data Validation → Settings tab → Allow: List → Source: click the range selector → navigate to the Lists sheet → select A2:A9 (the province names). The Source box will show =Lists!$A$2:$A$9. Alternatively, if the province range has been named "Provinces" via the Name Box, type =Provinces in the Source field directly (this works even across sheets and is more portable). Click OK. A dropdown arrow appears in each C cell. For a more robust setup: name the range (select A2:A9 on Lists sheet → Name Box → type Provinces → Enter), hide the Lists sheet (right-click tab → Hide), and protect the workbook structure (Review → Protect Workbook) so users cannot unhide and edit the source list.
Q2: You need a cascading dropdown where selecting a Province in column A changes the available Cities in column B. "Gauteng" should show Johannesburg, Pretoria, Ekurhuleni. "Western Cape" should show Cape Town, Stellenbosch, Paarl. How do you set this up?
✓ Step 1 — Create the named ranges: on the Lists sheet, type the Gauteng cities in one range (e.g., D2:D4) and select them → Name Box → type "Gauteng" → Enter. Type the Western Cape cities in another range (e.g., E2:E4) → Name Box → type "WesternCape" → Enter (no spaces allowed in named range names). Step 2 — Province dropdown: set column A validation to List using the Provinces list as normal. Step 3 — City dependent dropdown: select B2:B200 → Data Validation → List → Source: =INDIRECT(SUBSTITUTE(A2," ","_")). The SUBSTITUTE replaces spaces in "Western Cape" with underscores to match the named range "WesternCape". INDIRECT converts the text string into the corresponding named range. When A2 = "Gauteng", the cities dropdown shows Johannesburg, Pretoria, Ekurhuleni. When A2 = "Western Cape", it shows Cape Town, Stellenbosch, Paarl.
Q3: Write a custom Data Validation formula for column B that prevents duplicate values — each entry in B2:B200 must be unique. What error style should you use?
✓ Select B2:B200 → Data Validation → Custom → Formula: =COUNTIF($B$2:$B$200,B2)=1. The formula uses an absolute range ($B$2:$B$200 stays fixed as it applies to each cell) but a relative cell reference for the criteria (B2 shifts to B3, B4, etc. as the rule applies down the column). COUNTIF counts how many times the current cell's value appears in the entire range. =1 means it appears exactly once — valid. If someone tries to enter a value already in the list, COUNTIF returns 2 (or more), the formula returns FALSE, and the error alert fires. Use a Stop error style (red icon) with the title "Duplicate Entry" and message "This value already exists in the list. Each entry must be unique."
Q4: What are the three Error Alert styles in Data Validation, and when would you use each in an SA payroll context?
✓ Stop (red icon): completely blocks invalid entry; user cannot proceed without entering a valid value or cancelling. Use for fields that must be correct — SA ID numbers (must be 13 digits), employee numbers (must be unique), leave days (must be 1–30). An invalid payroll entry that gets through could cause incorrect PAYE calculations or UIF contributions. Warning (yellow triangle): shows a caution but allows the user to override by clicking Yes. Use for unusual but possible values — a salary above R200,000/month is flagged but valid for senior executives; overtime hours above 8 are warned but valid with prior approval. Information (blue circle): informs the user but always accepts the entry. Use for gentle guidance where overrides are routine — noting that a date is outside the standard reporting period but not necessarily wrong.
Q5: You have a spreadsheet with 500 rows of historical employee data. You now add a Data Validation rule requiring all ID numbers to be 13 characters. Some existing ID numbers are wrong. How do you identify which cells violate the new rule without checking each one manually?
✓ After applying the validation rule to the ID column: Data tab → Data Tools group → click the dropdown arrow on the Data Validation button → Circle Invalid Data. Excel draws a red oval circle around every cell in the validated range that currently contains data violating the rule — including all the pre-existing invalid entries that were entered before the rule was applied. Review each circled cell and correct the data. Once corrected: Data Validation dropdown → Clear Validation Circles to remove all circles. This is the professional approach for bulk data auditing — far faster than manually reviewing 500 rows.
Q6: What is the difference between the List validation type using a typed source ("Gauteng,Western Cape,KwaZulu-Natal") versus a range-based source (=Provinces)? Which is better for an SA HR system and why?
✓ Typed source: the values are stored directly in the Data Validation dialog. To add, remove, or edit any province, you must open the Data Validation dialog for every cell using that list and retype the entire source. If 50 cells use the same list, you update 50 dialogs. Range-based source (=Provinces): the values are stored in a range of cells (usually a dedicated hidden Lists sheet) assigned a named range. To update the list, you change the values in the source range once — all 50 dropdown cells automatically reflect the change. For an SA HR system, range-based is clearly better: (1) Lists can change (job titles, departments, cost centres change with restructuring) — one-place updates are essential; (2) The source list can be protected and hidden so only administrators can modify valid options; (3) The list is visible and auditable without opening dialog boxes; (4) Longer lists (all SA municipalities, all bank names, all job grades) are impractical to type as a comma-separated string.