ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Prevent a Weekend date entry (https://www.excelbanter.com/excel-worksheet-functions/165364-prevent-weekend-date-entry.html)

Anurag

Prevent a Weekend date entry
 
I have a column used to insert dates for a certain activity. Is is possible
for me to restrict someone from entering a date that falls on a specific day
of the week?

Thanks in advance
Anurag

Rick Rothstein \(MVP - VB\)

Prevent a Weekend date entry
 
I have a column used to insert dates for a certain activity. Is is possible
for me to restrict someone from entering a date that falls on a specific
day
of the week?


If we are talking about a user typing in a date, you could use Excel's
Data/Validation menu item to do that. For example, to restrict the user from
entering a date that falls on a Wednesday, you could select the entire
column and then use this Custom Formula in the Data/Validation dialog box...

=WEEKDAY(A1)<4

where I have assumed the dates are in Column A.

Rick


Anurag

Prevent a Weekend date entry
 
That worked. I had tried using the same formula earlier without actually
selecting the entire column and that didnt work for me.

Since I wanted the weekend, I tied to use this formula:
=OR(WEEKDAY(D1)<1,WEEKDAY(D1)<7)

But with this, nothing is working!

"Rick Rothstein (MVP - VB)" wrote:

I have a column used to insert dates for a certain activity. Is is possible
for me to restrict someone from entering a date that falls on a specific
day
of the week?


If we are talking about a user typing in a date, you could use Excel's
Data/Validation menu item to do that. For example, to restrict the user from
entering a date that falls on a Wednesday, you could select the entire
column and then use this Custom Formula in the Data/Validation dialog box...

=WEEKDAY(A1)<4

where I have assumed the dates are in Column A.

Rick



Rick Rothstein \(MVP - VB\)

Prevent a Weekend date entry
 
You don't want OR for that combination... you want AND

=AND(WEEKDAY(D1)<1,WEEKDAY(D1)<7)

Both must be true for the date to be on Monday thru Friday; however, by
using the optional 2nd argument for the WEEKDAY function, you can use a
simple formula like the original one I posted. Try this custom validation
formula instead (note the 2 in the second argument of the WEEKDAY function
call)...

=WEEKDAY(D1,2)<6

Rick


"Anurag" wrote in message
...
That worked. I had tried using the same formula earlier without actually
selecting the entire column and that didnt work for me.

Since I wanted the weekend, I tied to use this formula:
=OR(WEEKDAY(D1)<1,WEEKDAY(D1)<7)

But with this, nothing is working!

"Rick Rothstein (MVP - VB)" wrote:

I have a column used to insert dates for a certain activity. Is is
possible
for me to restrict someone from entering a date that falls on a
specific
day
of the week?


If we are talking about a user typing in a date, you could use Excel's
Data/Validation menu item to do that. For example, to restrict the user
from
entering a date that falls on a Wednesday, you could select the entire
column and then use this Custom Formula in the Data/Validation dialog
box...

=WEEKDAY(A1)<4

where I have assumed the dates are in Column A.

Rick




Anurag

Prevent a Weekend date entry
 
Nevermind. I got it. Many thanks.

"Rick Rothstein (MVP - VB)" wrote:

I have a column used to insert dates for a certain activity. Is is possible
for me to restrict someone from entering a date that falls on a specific
day
of the week?


If we are talking about a user typing in a date, you could use Excel's
Data/Validation menu item to do that. For example, to restrict the user from
entering a date that falls on a Wednesday, you could select the entire
column and then use this Custom Formula in the Data/Validation dialog box...

=WEEKDAY(A1)<4

where I have assumed the dates are in Column A.

Rick




All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com