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:

cleaner-dates-with-excel-conditional-formatting-demo

cleaner-dates-with-conditional-formatting-setting up the rulesHow to ensure cleaner dates with conditional formatting?

  1. Let’s say your users need to enter date input in cell C3.
  2. Select C3 and go to Home > Conditional Formatting > New Rule
  3. Select the rule type as “Use a formula…”
  4. Use a formula like this: =ISERROR(DAY($C$3))
  5. Set up formatting to highlight incorrect dates
  6. Done

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,

  1. Let’s say the date inputs go to column C, starting with C3 as first input
  2. Select all the cells in column C that will have dates
  3. Set up the conditional formatting with below rule:
  4. =ISERROR(DAY($C3))

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: