Create custom calendar

girapas

Board Regular
Joined
Apr 20, 2004
Messages
150
I need to get in Excel 2003 the following:
a) Automatically create a calendar table for each year, as shown below in my example for 2012.
b) Conditional formatting (coloring) Saturdays, Sundays and public holidays.
c) Calculate working (business) days in B40.

I've created separate sheets (one for each year 2012, 2013 etc.) with public holidays. In that sheets there's the date (format dddd,d-mmm-yy), in column A, and the name of the public holiday, in column B.
The date range (column A) is Named as: publ_hol2012, publ_hol2013 and so on.

Thanks in advance


Book1
ABCDEFGHIJKLM
12012JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC
2SUN111
3MON2221
4TUE33132
5WED4142413
6THU521535241
7FRI6326416352
8SAT743752741631
9SUN854863852742
10MON965974963853
11TUE107610851074964
12WED1187119611851075
13THU12981210712961186
14FRI1310913118131071297
15SAT141110141291411813108
16SUN1512111513101512914119
17MON161312161411161310151210
18TUE171413171512171411161311
19WED181514181613181512171412
20THU191615191714191613181513
21FRI201716201815201714191614
22SAT211817211916211815201715
23SUN221918222017221916211816
24MON232019232118232017221917
25TUE242120242219242118232018
26WED252221252320252219242119
27THU262322262421262320252220
28FRI272423272522272421262321
29SAT282524282623282522272422
30SUN292625292724292623282523
31MON302726302825302724292624
32TUE3128272926312825302725
33WED292830272926312826
34THU29312830272927
35FRI302931283028
36SAT31302929
37SUN3030
38MON31
39
40WORKING DAYS
41
Sheet7
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
OK...Here you go:
Using your posted scenario
• Format B1:M38 with a custom format that only displays the day number
...CTRL+1...Number_tab...Category: Custom...Type: D...Press: Enter
• B2: =IF(ISNUMBER(B1),B1+1,IF(TEXT(WEEKDAY("1-"&B$1&"-"&$A$1),"DDD")=$A2,--("1-"&B$1&"-"&$A$1),""))
• B9: B8+1
• Copy B9 down through B28
• B29: =IF(OR(MONTH(B28+1)<>MONTH(B28),B28=""),"",B28+1)
• Copy B29 down through B38
• Copy B2:B38...Select B2:M38...Press: ENTER

For the holidays:
On a tab named HolidayTab
• List all holidays for all years beginning in cell A1.
• Name the Col_A date list: rngHolidays
Code:
Example for 2012...cells A1:B13
Monday, January 02, 2012             New Year's Holiday 2012
Monday, January 16, 2012             MLK Birthday
Monday, February 20, 2012            Presidents Day
Monday, May 28, 2012                 Memorial Day
Wednesday, July 04, 2012             Independence Day
Monday, September 03, 2012           Labor Day
Monday, October 15, 2012             Columbus Day
Thursday, November 22, 2012          Thanksgiving
Friday, November 23, 2012            Day After Thanksgiving
Monday, December 24, 2012            Day before Xmas
Tuesday, December 25, 2012           XMas Day
Monday, December 31, 2012            Day before New Year
Tuesday, January 01, 2013            New Year's day 2013

Back to the calendar sheet
• Select B2:M38, with B2 as the active cell
• Format.Conditional_formatting
...Formula is: =ISNUMBER(MATCH(B2,rngHolidays,0))
...Click: Format...set the fill color for holiday cells
...Click: OK

That's it.
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,320
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top