validate date entered

  • Thread starter Thread starter jatman
  • Start date Start date
J

jatman

i want to validate the date entered as a Sunday - if the user enters a date
that is not a Sunday, the user cannot continue.

cell A1 - user enters the date (the cell is formatted as custom yyyy-mm-dd)
cell A2 - text(a1,"dddd") returns back the day of the week

is there a way to validate the value as a Sunday date.

jat
 
Select cell A1
Goto the menu Data>Validation
Allow: Custom
Formula: =WEEKDAY(A1)=1

You can use custom input or error alert messages if you want.

OK out
 
Not sure how you want to do the validation, but this will return TRUE if the
date in A1 is a Sunday and FALSE otherwise...

=WEEKDAY(A1)=1

So, you could do some variation on this for your validation formula...

=IF(WEEKDAY(A1)=1,"That date is a Sunday","Sorry, it's not a Sunday")
 
Add Data Validation to A1. Select Data (ribbon tab in XL2007 or menu bar in
earlier versions) >> Data Validation >> set Allow to Custom >> for Formula
enter
=WEEKDAY(A1)=1) >> on the Error Alert tab, set the message to display if
a non-Sunday date is entered >> OK.

Hope this helps,

Hutch
 
Back
Top