[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How not allow entry of weekend dates or holiday dates

Posted on 2011-03-17
6
Medium Priority
?
260 Views
Last Modified: 2012-05-11
How can I disallow the entry of a weekend date or holiday date in a particular cell?  I do have a named range named "Holidays" with the dates in place.

--Steve
0
Comment
Question by:SteveL13
6 Comments
 
LVL 5

Expert Comment

by:Phoenixke
ID: 35156005
0
 

Author Comment

by:SteveL13
ID: 35156062
Although I found this somewhat helpful it didn't really provide a solution to my question unless I'm missing something.
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35156197
there is another excel question regarding date restriction in this portal:
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_25784324.html

you can download the sample excel file and change the code to suits your date selection needs.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 9

Accepted Solution

by:
McOz earned 2000 total points
ID: 35156345
Steve, use custom data validation with a formula like this:

=AND(WEEKDAY(A1)<>1,WEEKDAY(A1)<>7,ISERROR(MATCH(DATE(DAY(A1),MONTH(A1),YEAR(TODAY())),DATE(DAY(E1:E6),MONTH(E1:E6),YEAR(TODAY())),0)))

Where E1:E6 is your holidays range. For some reason I couldn't get it working with a named range, but maybe you will find a way!

Cheers
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 35156360
Which version of Excel are you using, Steve?

If you have Excel 2007 or later you can use data validation - Assuming you want to restrict cell E2 to workdays choose "custom" option and enter this formula

=WORKDAY(E2+1,-1,Holidays)=E2

If the cell is currently empty you'll get a warning that the formula evaluates to an error - that's OK, you can ignore that.

It's possible in earlier versions but you'll need a more complex formula.....

regards, barry
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 35156485
Actually McOz, I got the same thing - couldn't make it work with the named range but it works with a specific range as long as that range is on the same sheet, e.g.

=WORKDAY(E2+1,-1,H$1:H$10)=E2

where holidays are in H1:H10

In Excel 2003 or earlier you can use this version

=AND(WEEKDAY(E2,2)<6,COUNTIF(H$1:H$10,E2)=0)

If you have the holiday range on another sheet you can make it work with INDIRECT function, e.g. if holidays are in H1:H10 on a different sheet [sheet2] you can use this version

=AND(WEEKDAY(E2,2)<6,COUNTIF(INDIRECT("Sheet2!H1:H10"),E2)=0)

regards, barry
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question