validate date entered

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
 
T

T. Valko

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
 
R

Rick Rothstein

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")
 
T

Tom Hutchins

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top