excel An array formula calendar

igure 3-7 shows a worksheet set up to display a calendar for any month. (Change the month,
and the calendar updates.) Believe it or not, the calendar is created with a single array formula
that occupies 42 cells.
The array formula, entered in the range B5:H10, is

{=IF(MONTH(DATE(YEAR(B3),MONTH(B3),1))<>MONTH(DATE(YEAR(B3),
MONTH(B3),1)-(WEEKDAY(DATE(YEAR(B3),MONTH(B3),1))-1)
+{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1),””,
DATE(YEAR(B3),MONTH(B3),1)-(WEEKDAY(DATE(YEAR(B3),
MONTH(B3),1))-1)+{0;1;2;3;4;5}*7+{1,2,3,4,5,6,7}-1)}

The formula returns date serial numbers, and you need to format the cells to display the day
number only by using a custom number format (“d”).