Ensure cleaner input dates with conditional formatting [quick tip]
Here is a familiar problem:
You create a workbook to track some data. You ask your staff to fill up the data. Almost all the input data is fine, except the date column. Every one types dates in their own format.
Here is a fun, simple & powerful way to warn your users when they enter wrong dates.
Use conditional formatting
Here is a quick demo:
How to ensure cleaner dates with conditional formatting?
- Let’s say your users need to enter date input in cell C3.
- Select C3 and go to Home > Conditional Formatting > New Rule
- Select the rule type as “Use a formula…”
- Use a formula like this: =ISERROR(DAY($C$3))
- Set up formatting to highlight incorrect dates
Explanation for the formula:
We will assume that C3 contains a valid date and try to do some sort of date operation on it, like finding the day of month using DAY($C$3). If this returns an error, that means we have an invalid date.
So to check the error status, we use ISERROR().
A caveat: dates are numbers
Since Excel dates are numbers, technically, your users can type a number in C3 (like 7) and our conditional formatting won’t trigger the error.
Bonus tip: Adding conditional formatting to an entire column
To add conditional formatting to an entire column,
- Let’s say the date inputs go to column C, starting with C3 as first input
- Select all the cells in column C that will have dates
- Set up the conditional formatting with below rule:
Download example workbook
Click here to download a simple example workbook with this technique. Examine the conditional formatting in C3 & D3 to learn more.
Do you use CF to nudge your users in right direction?
Excel Conditional Formatting is one of my all time favourite features. I use liberal amounts of CF on all my Excel recipes. I think CF makes a great ingredient if you are collecting user inputs.
What about you? Do you use conditional formatting to make sure your inputs are clean? What techniques do you use? Please share your thoughts and tips in the comments area.
Here are few more awesome ways to use conditional formatting:
- CF + Data validation to make awesome data entry forms
- Checking for hard-coded formulas with CF
- To do list with priorities- built with CF, formulas & love
- More on conditional formatting
Leave a Reply
|How would you train your boss to use Excel better? [Weekend Survey]||Narrating the story of change using Excel charts – case study|