在第一列以外的任何一個儲存格開始,選取至少七欄,然後將下面那串貼上,按下Ctrl+Shift+Enter,在指示的地方輸入年月後就是月曆了
=IFERROR(IF(ROW()<=MIN(ROW()+1),{"月曆","年","月","","在年月的","上方輸入","起始的","年和月";"","日","一","二","三","四","五","六"},CHOOSE(IF(COLUMN()=MIN(COLUMN()),1,IF(COLUMN()<=MIN(COLUMN())+7,2,3)),IF(INT(TEXT(DATE(INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+1)),INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+2)),1)+(ROW()-MIN(ROW())-2)*7+1-WEEKDAY(DATE(INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+1)),INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+2)),1)),"d"))>7,"",TEXT(DATE(INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+1)),INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+2)),1)+(ROW()-MIN(ROW())-2)*7+1-WEEKDAY(DATE(INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+1)),INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+2)),1)),"yy-mm")),TEXT(IF((COLUMN()-MIN(COLUMN())=WEEKDAY(DATE(INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+1)),INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+2)),1)))*(ROW()=MIN(ROW())+2),DATE(INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+1)),INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+2)),1),DATE(INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+1)),INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+2)),1)+(ROW()-MIN(ROW())-2)*7+COLUMN()-MIN(COLUMN())-WEEKDAY(DATE(INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+1)),INDIRECT(ADDRESS(MIN(ROW())-1,MIN(COLUMN())+2)),1))),"dd"),"-")),"") |
GIF展示