<$BlogRSDURL$>

May 14, 2004

Error! Part 1

There are many ways to show a user that he or she has entered an incorrect value into a cell.

I like to show an example using Data Validation. Let's assume that a person's date of birth must be entered into cell A1 as an entry requirement for a club where membership is restricted to people 20 years old or more.

Here's one possible formula. (I added the ISNUMBER function just in case someone enters something besides a date. Don't forget that dates in Excel are just numbers formatted in a special way)

=AND(ISNUMBER(A1),(A1+1)>DATE(YEAR(TODAY())-20,MONTH(TODAY()),DAY(TODAY())))

Open the Validation dialog box from the Data menu at the top and select Custom for the Validation criteria. Then enter the above formula into the text box provided.




Next, select the Error Alert tab at the top and enter your custom Title and Error message.




Here what appears if you make an error.



Although my Error message doesn't really apply if someone has done something like entered text instead of a number, it should still get the point across.

Comments: Post a Comment

This page is powered by Blogger. Isn't yours?