I'm trying to create a Federal Employee Calendar. I've historical dataset of the Federal Holidays since 2017 going till the year 2030 as shown below:
I would like to use Conditional Formatting to highlight the Holidays with a RED fill color and WHITE font color in the below calendar:
I was trying to use a the following formula to find the Holidays that are in the below named range although it returns an error:
I know that I'm formatting the dates in a specific way and if I format the dates as
then the formula will evalute to
I would like to write the named range so that it is dynamic so that if I increment the year in either direction which changes the value of
It will adjust the dynamic range and get the correct years dates.
Cell Formulas | ||
---|---|---|
Range | Formula | |
B2:O2 | B2 | =DATE(B$1,1,1)+CHOOSE(WEEKDAY(DATE(B$1,1,1)),1,0,0,0,0,0,-1) |
B3:O3 | B3 | =DATE(B$1,1,(1+7*3)-WEEKDAY(DATE(B$1,1,8-2))) |
B4:O4 | B4 | =DATE(B$1,2,(1+7*3)-WEEKDAY(DATE(B$1,2,8-2))) |
B5:O5 | B5 | =DATE(B$1,6,1)-WEEKDAY(DATE(B$1,6,6)) |
B6:O6 | B6 | =DATE(B$1,6,19)+CHOOSE(WEEKDAY(DATE(B$1,6,19)),1,0,0,0,0,0,-1) |
B7:O7 | B7 | =DATE(B$1,7,4)+CHOOSE(WEEKDAY(DATE(B$1,7,4)),1,0,0,0,0,0,-1) |
B8:O8 | B8 | =DATE(B$1,9,(1+7*1)-WEEKDAY(DATE(B$1,9,8-2))) |
B9:O9 | B9 | =DATE(B$1,10,(1+7*2)-WEEKDAY(DATE(B$1,10,8-2))) |
B10:O10 | B10 | =DATE(B$1,11,11)+CHOOSE(WEEKDAY(DATE(B$1,11,11)),1,0,0,0,0,0,-1) |
B11:O11 | B11 | =DATE(B$1,11,(1+7*4)-WEEKDAY(DATE(B$1,11,8+2))) |
B12:O12 | B12 | =DATE(B$1,12,25)+CHOOSE(WEEKDAY(DATE(B$1,12,25)),1,0,0,0,0,0,-1) |
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
HolidayRange | =OFFSET(INDIRECT(ADDRESS(1, MATCH(CurrentYear, Years,0),1,1)),0,0,COUNTA(HOLIDAYS!$A:$A)) | I2:I12 |
I would like to use Conditional Formatting to highlight the Holidays with a RED fill color and WHITE font color in the below calendar:
Calendar.1.xlsx | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | |||
1 | 2024 | ||||||||||||||||||||||||||
2 | |||||||||||||||||||||||||||
3 | January | February | March | ||||||||||||||||||||||||
4 | SUN | MON | TUE | WED | THU | FRI | SAT | SUN | MON | TUE | WED | THU | FRI | SAT | SUN | MON | TUE | WED | THU | FRI | SAT | ||||||
5 | 01 | 02 | 03 | 04 | 05 | 06 | 01 | 02 | 03 | 01 | 02 | ||||||||||||||||
6 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | ||||||
7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | ||||||
8 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ||||||
9 | 28 | 29 | 30 | 31 | 25 | 26 | 27 | 28 | 29 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | |||||||||||
10 | 31 | ||||||||||||||||||||||||||
11 | |||||||||||||||||||||||||||
12 | April | May | June | ||||||||||||||||||||||||
13 | SUN | MON | TUE | WED | THU | FRI | SAT | SUN | MON | TUE | WED | THU | FRI | SAT | SUN | MON | TUE | WED | THU | FRI | SAT | ||||||
14 | 01 | 02 | 03 | 04 | 05 | 06 | 01 | 02 | 03 | 04 | 01 | ||||||||||||||||
15 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | ||||||
16 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 09 | 10 | 11 | 12 | 13 | 14 | 15 | ||||||
17 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ||||||
18 | 28 | 29 | 30 | 26 | 27 | 28 | 29 | 30 | 31 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | |||||||||||
19 | 30 | ||||||||||||||||||||||||||
20 | |||||||||||||||||||||||||||
21 | July | August | September | ||||||||||||||||||||||||
22 | SUN | MON | TUE | WED | THU | FRI | SAT | SUN | MON | TUE | WED | THU | FRI | SAT | SUN | MON | TUE | WED | THU | FRI | SAT | ||||||
23 | 01 | 02 | 03 | 04 | 05 | 06 | 01 | 02 | 03 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | |||||||||||
24 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | ||||||
25 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | ||||||
26 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | ||||||
27 | 28 | 29 | 30 | 31 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 29 | 30 | ||||||||||||||
28 | |||||||||||||||||||||||||||
29 | |||||||||||||||||||||||||||
30 | October | November | December | ||||||||||||||||||||||||
31 | SUN | MON | TUE | WED | THU | FRI | SAT | SUN | MON | TUE | WED | THU | FRI | SAT | SUN | MON | TUE | WED | THU | FRI | SAT | ||||||
32 | 01 | 02 | 03 | 04 | 05 | 01 | 02 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | |||||||||||||
33 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | ||||||
34 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | ||||||
35 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | ||||||
36 | 27 | 28 | 29 | 30 | 31 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 29 | 30 | 31 | ||||||||||||
37 | |||||||||||||||||||||||||||
CALENDAR_PORTRAIT |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A1 | A1 | =CurrentYear |
B3 | B3 | =DATE(CurrentYear,1,1) |
J3 | J3 | =DATE(CurrentYear,2,1) |
R3 | R3 | =DATE(CurrentYear,3,1) |
B5,R32,J32,B32,R23,J23,B23,R14,J14,B14,R5,J5 | B5 | =B3-(WEEKDAY(B3,1)-1) |
C5:H10,S32:X37,K32:P37,C32:H37,S23:X28,K23:P28,C23:H28,S14:X19,K14:P19,C14:H19,S5:X10,K5:P10 | C5 | =B5+1 |
B6:B10,R33:R37,J33:J37,B33:B37,R24:R28,J24:J28,B24:B28,R15:R19,J15:J19,B15:B19,R6:R10,J6:J10 | B6 | =B5+7 |
B12 | B12 | =DATE(CurrentYear,4,1) |
J12 | J12 | =DATE(CurrentYear,5,1) |
R12 | R12 | =DATE(CurrentYear,6,1) |
B21 | B21 | =DATE(CurrentYear,7,1) |
J21 | J21 | =DATE(CurrentYear,8,1) |
R21 | R21 | =DATE(CurrentYear,9,1) |
B30 | B30 | =DATE(CurrentYear,10,1) |
J30 | J30 | =DATE(CurrentYear,11,1) |
R30 | R30 | =DATE(CurrentYear,12,1) |
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
CurrentYear | =SETTINGS!$C$5 | B3:H3, B12:H12, B21:H21, B30:H30, J3:P3, J12:P12, J21:P21, J30:P30, R3:X3, R12:X12, R21:X21, R30:X30 |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
R5:X10 | Expression | =MONTH(R5)<>MONTH($R$3) | text | YES |
B5:H10 | Expression | =MONTH(B5)<>MONTH($B$3) | text | YES |
R32:X37 | Expression | =MONTH(R32)<>MONTH($R$30) | text | YES |
J32:P37 | Expression | =MONTH(J32)<>MONTH($J$30) | text | YES |
B32:H37 | Expression | =MONTH(B32)<>MONTH($B$30) | text | YES |
R23:X28 | Expression | =MONTH(R23)<>MONTH($R$21) | text | YES |
J23:P28 | Expression | =MONTH(J23)<>MONTH($J$21) | text | YES |
B23:H28 | Expression | =MONTH(B23)<>MONTH($B$21) | text | YES |
R14:X19 | Expression | =MONTH(R14)<>MONTH($R$12) | text | YES |
J14:P19 | Expression | =MONTH(J14)<>MONTH($J$12) | text | YES |
B14:H19 | Expression | =MONTH(B14)<>MONTH($B$12) | text | YES |
J5:P10 | Expression | =MONTH(J5)<>MONTH($J$3) | text | YES |
B5:H10,J5:P10,R5:X10,B14:H19,J14:P19,R14:X19,B23:H28,J23:P28,R23:X28,B32:H38,J32:P38,R32:X38 | Expression | =OR(WEEKDAY(B5)=1, WEEKDAY(B5)=7) | text | NO |
G:G,O:O,W:W | Expression | =ISNUMBER(MATCH(G1,AltFriday,0)) | text | NO |
I was trying to use a the following formula to find the Holidays that are in the below named range although it returns an error:
Calendar.1.xlsx | |||
---|---|---|---|
AE | |||
9 | FALSE | ||
CALENDAR_PORTRAIT |
Cell Formulas | ||
---|---|---|
Range | Formula | |
AE9 | AE9 | =ISNUMBER(MATCH(C5,HolidayRange,0)) |
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
HolidayRange | =OFFSET(INDIRECT(ADDRESS(1, MATCH(CurrentYear, Years,0),1,1)),0,0,COUNTA(HOLIDAYS!$A:$A)) | I2:I12 |
I know that I'm formatting the dates in a specific way and if I format the dates as
Excel Formula:
GENERAL
Excel Formula:
TRUE
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
CurrentYear | =SETTINGS!$C$5 | B3:H3, B12:H12, B21:H21, B30:H30, J3:P3, J12:P12, J21:P21, J30:P30, R3:X3, R12:X12, R21:X21, R30:X30 |
Calendar.1.xlsx | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | ||||||
2 | Settings | |||||
3 | ||||||
4 | ||||||
5 | Year: | 2024 | ||||
6 | ||||||
SETTINGS |
It will adjust the dynamic range and get the correct years dates.