SteveL13
asked on
How not allow entry of weekend dates or holiday dates
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
--Steve
ASKER
Although I found this somewhat helpful it didn't really provide a solution to my question unless I'm missing something.
there is another excel question regarding date restriction in this portal:
https://www.experts-exchange.com/questions/25784324/Restrict-cell-entry-by-date-and-add-a-message.html
you can download the sample excel file and change the code to suits your date selection needs.
https://www.experts-exchange.com/questions/25784324/Restrict-cell-entry-by-date-and-add-a-message.html
you can download the sample excel file and change the code to suits your date selection needs.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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)
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
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,COUNT IF(H$1:H$1 0,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,COUNT IF(INDIREC T("Sheet2! H1:H10"),E 2)=0)
regards, barry
=WORKDAY(E2+1,-1,H$1:H$10)
where holidays are in H1:H10
In Excel 2003 or earlier you can use this version
=AND(WEEKDAY(E2,2)<6,COUNT
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,COUNT
regards, barry
http://office.microsoft.com/en-us/excel-help/designate-valid-cell-entries-HP005202210.aspx