Most individuals arrange a dropdown record to make spreadsheets smarter with Excel’s knowledge validation. Nevertheless, the Customized choice within the Knowledge Validation dialog accepts any method that returns TRUE or FALSE, which suggests you possibly can implement guidelines that dropdowns weren’t constructed to deal with.
Duplicate prevention, textual content sample necessities, date restrictions, and calculated limits all run by means of one setting that most individuals skip proper previous. Here is how I take advantage of customized formulation to lock down my spreadsheets correctly.
Associated
Excel’s SEQUENCE perform made me notice I might been losing time manually filling date columns
It changed my date-filling workflow, and I am not going again.
Customized formulation allow you to management way over an inventory
The Customized choice accepts any TRUE/FALSE method as a validation rule
Excel’s knowledge validation has a number of built-in choices similar to complete numbers, decimals, dates, textual content size, and, after all, dropdown lists — it is a type of Excel methods price studying early. These cowl frequent situations, however they’re inflexible. The second you want a rule that does not match neatly into a type of classes, you are caught. That is the place the Customized choice is available in.
It allows you to write a method that evaluates to TRUE or FALSE. If the method returns TRUE, Excel accepts the entry. If it returns FALSE, the entry will get rejected. Here is find out how to set it up:
- Choose the cell or vary you wish to validate.
- Go to the Knowledge tab and click on Knowledge Validation.
- Underneath Permit, choose Customized.
- Enter your method within the System area.
- Click on the Error Alert tab and write a transparent message explaining why an entry may be rejected.
- Click on OK.
Keep in mind that when making use of validation to a variety, your method ought to reference the primary cell in that vary. Excel robotically adjusts the reference for the remaining cells, identical to it does while you drag a method down. In the event you get this improper, your validation will both not work or apply the identical examine to each cell no matter place.
Any method that produces a TRUE/FALSE consequence works — COUNTIF, AND, OR, LEN, LEFT, ISNUMBER, and even nested combos. In the event you can write it in a cell, you should use it as a validation rule.
Forestall duplicate entries with a COUNTIF method
It flags repeats earlier than they trigger issues
Screenshot by Yasir Mahmood
Duplicates are one of the crucial frequent knowledge entry errors, they usually’re annoying to scrub up after the actual fact. Worker IDs, bill numbers, and e-mail addresses should not seem twice in the identical column. As an alternative of scanning for duplicates manually, making an attempt to focus on duplicates in Excel after the actual fact, or working a cleanup later, you possibly can cease them on the level of entry.
You need to use the next method:
=COUNTIF($A:$A,A1)=1
This counts what number of occasions the worth in A1 seems in column A. If it seems precisely as soon as, the entry is legitimate. If COUNTIF returns a price higher than 1, it means a replica already exists, and Excel blocks it.
For instance, say you are monitoring order IDs in column A. You enter “ORD-1042” in A2, and it is accepted as a result of it is the primary occasion. If somebody tries getting into “ORD-1042” once more in A10, the validation kicks in and rejects it.
Utilizing $A:$A because the vary works fantastic for smaller datasets, nevertheless it forces Excel to scan the complete column. In the event you’re working with hundreds of rows, narrowing the vary to one thing like $A$2:$A$500 improves efficiency. It is a small adjustment, nevertheless it issues on bigger spreadsheets.
Pressure entries to comply with a selected sample or size
LEN and LEFT maintain the info constant
Inconsistent entries are a quiet drawback. Somebody varieties a 5-character product code the place it ought to be 8, or skips the required prefix, and now your filter breaks downstream. Customized validation can implement each size and sample in a single rule. For size, you should use the next method:
=LEN(A2)=8
This rejects something that is not precisely 8 characters. For a required prefix, use LEFT:
=LEFT(A2,3)=”PRD”
You’ll be able to mix each situations with AND to implement them concurrently:
=AND(LEN(A2)=8,LEFT(A2,3)=”PRD”)
For instance, in case your stock system makes use of codes like “PRD-1047”, at all times 8 characters, at all times beginning with “PRD”, then this method ensures each entry follows that construction. Sort “PRD-1047” and it is accepted. Sort “PR-1047” or “INV-1047” and Excel rejects it on the spot.
That is helpful when a number of folks work on the identical spreadsheet. You’ll be able to’t at all times management how fastidiously somebody reads the formatting directions, however you can also make positive Excel enforces them regardless.
Prohibit dates so nobody enters something previously
TODAY() retains your date entries forward-looking
A previous date in a deadline or supply column is sort of at all times a mistake. Somewhat than catching these errors throughout evaluate, you possibly can block them outright with a easy method:
=A2>=TODAY()
This ensures each date entered is both right now or sooner or later. Since TODAY() recalculates robotically, the validation stays present with none guide updates. You’ll be able to go additional by proscribing entries to a selected window. For instance, when you solely need dates throughout the subsequent 30 days:
=AND(A2>=TODAY(),A2<=TODAY()+30)
This proves helpful for scheduling kinds the place somebody reserving a gathering three months out can be simply as improper as getting into yesterday’s date.
This validation solely checks the entry on the time it is typed. If somebody enters tomorrow’s date right now, it will not retroactively flag it as invalid as soon as that date passes. For that, you’d want conditional formatting as a secondary examine.
These guidelines get stronger while you mix them
Stack a number of situations for tighter management
Most examples lined right here use a single situation, however AND and OR allow you to layer a number of checks into one method. You would validate {that a} cell accommodates a future date, falls inside price range, and follows a naming conference — all in a single rule. Pair that with customized error messages that designate precisely what went improper, and you have constructed a spreadsheet that virtually trains folks to enter knowledge accurately. From right here, including conditional formatting to visually flag borderline entries might be the following step.

