跳到主要內容

如何在Excel中計算復活節日期?

doc計算復活節日期1

眾所周知,復活節假期始終是21月XNUMX日或之後發生的第一個教會滿月之後的第一個星期日,因此每年的複活節日期可能與以下屏幕截圖所示的日期不同。 為了獲得給定年份的特定復活節日期,本文可能會對您有所幫助。

用公式計算給定年份的複活節日期

使用用戶定義的函數計算給定年份的複活節日期


箭頭藍色右氣泡 用公式計算給定年份的複活節日期

要獲取給定年份的複活節日期,以下公式可以為您提供幫助,請執行以下操作:

1。 輸入以下公式: =FLOOR("5/"&DAY(MINUTE(A2/38)/2+56)&"/"&A2,7)-34 在給定年份旁邊的空白單元格中, B2,例如,請參見屏幕截圖:

doc計算復活節日期2

2。 然後將填充手柄向下拖動到要計算給定日期的複活節日期的單元格,並在單元格中顯示五位數字,請參見屏幕截圖:

doc計算復活節日期3

3。 然後,您應該將他的數字格式化為日期格式:

(1.)選擇5位數字,然後右鍵單擊以選擇 單元格格式 從上下文菜單中;

(2.)在彈出 單元格格式 對話框,單擊 聯繫電話 選項卡,然後選擇 日期 來自 類別 窗格,然後從右側列錶框中選擇您喜歡的一種日期格式,請參見屏幕截圖:

doc計算復活節日期4

4。 然後,數字已根據需要設置為日期格式,可以獲取給定年份的複活節日期,請參見屏幕截圖:

doc計算復活節日期5

保養竅門: 要將數字格式化為您的正常使用的日期格式,您還可以使用Kutools for Excel的Apply Date Formatting實用程序,如以下屏幕截圖所示:

doc計算復活節日期6


箭頭藍色右氣泡 使用用戶定義的函數計算給定年份的複活節日期

下面 用戶自定義函數 還可以幫助您計算特定年份的複活節日期。

1。 按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications 窗口。

2。 點擊 插入 > 模塊,然後將以下代碼粘貼到 模塊 窗口。

VBA代碼:計算給定年份的複活節日期:

Public Function EasterDate(Yr As Integer) As Date
'Updateby Extendoffice 20160530
  Dim x As Integer
  x = (((255 - 11 * (Yr Mod 19)) - 21) Mod 30) + 21
  EasterDate = DateSerial(Yr, 3, 1) + x + (x > 48) + 6 - ((Yr + Yr \ 4 + _
      x + (x > 48) + 1) Mod 7)
End Function

3。 然後保存並關閉此代碼,返回工作表並輸入以下公式: = easterdate(A2) 到相應數據旁邊的空白單元格中,然後將填充手柄向下拖動到要應用此公式的單元格,您將獲得一些五位數字,請參見屏幕截圖:

doc計算復活節日期7

5。 然後,您應該根據需要將數字更改為日期格式。 請查看上述方法的步驟3以將其格式化為最新格式.

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Excel verison, more simple, you only have to change L3 at the beginning to the cell where you will put the year (like 2022) in. 
=LET(Y;L3;A;MOD(Y;19);B;MOD(Y;4);C;MOD(Y;7);D;MOD(19*A+24;30);E;MOD(2*B+4*C+6*D+5;7);H;IFS(AND(E=6;D=29);50;AND(E=6;D=28;A>10);49;TRUE;22+D+E);IF(H<=31;DATE(Y;3;H);DATE(Y;4;H-31)))
This comment was minimized by the moderator on the site
Hello hztamas, Thank you a lot for your share. I changed the ";" to "," in your formula so it can work in Excel. I have data (like 2013) in cell A1.=LET(Y,A1,A,MOD(Y,19),B,MOD(Y,4),C,MOD(Y,7),D,MOD(19*A+24,30),E,MOD(2*B+4*C+6*D+5,7),H,IFS(AND(E=6,D=29),50,AND(E=6,D=28,A>10),49,TRUE,22+D+E),IF(H<=31,DATE(Y,3,H),DATE(Y,4,H-31)))This formula works, but I think it is not so much simpler than the formula in the article. Anyway, I think they are both great. Thanks again!Sincerely,Mandy
This comment was minimized by the moderator on the site
It works on google sheets. It is very long but works without error for the problematic years too (what you mentioned here). You can copy to a cell and in K1 cell the year is expected, like 2022

=DATE(K1;IF((IFS(AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=29);50;AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=28;MOD(K1;19)>10);50;TRUE;22+MOD(19*MOD(K1;19)+24;30)+MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)))<=31;3;4);IF((IFS(AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=29);50;AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=28;MOD(K1;19)>10);50;TRUE;22+MOD(19*MOD(K1;19)+24;30)+MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)))<=31;IFS(AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=29);50;AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=28;MOD(K1;19)>10);49;TRUE;22+MOD(19*MOD(K1;19)+24;30)+MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7));(IFS(AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=29);50;AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=28;MOD(K1;19)>10);49;TRUE;22+MOD(19*MOD(K1;19)+24;30)+MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)))-31))
This comment was minimized by the moderator on the site
Hello hztamas,
Thanks for your share. This formula does work without error on google sheets. Thanks!
Sincerely,
Mandy
This comment was minimized by the moderator on the site
It works on google sheets. It is very long but works without error for the problematic years too (what you mentioned here). You can copy to a cell and in K1 cell the year is expected, like 2022
=DATE(K1;IF((IFS(AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=29);50;AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=28;MOD(K1;19)>10);50;TRUE;22+MOD(19*MOD(K1;19)+24;30)+MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)))<=31;3;4);IF((IFS(AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=29);50;AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=28;MOD(K1;19)>10);50;TRUE;22+MOD(19*MOD(K1;19)+24;30)+MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)))<=31;IFS(AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=29);50;AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=28;MOD(K1;19)>10);49;TRUE;22+MOD(19*MOD(K1;19)+24;30)+MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7));(IFS(AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=29);50;AND(MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)=6;MOD(19*MOD(K1;19)+24;30)=28;MOD(K1;19)>10);49;TRUE;22+MOD(19*MOD(K1;19)+24;30)+MOD(2*MOD(K1;4)+4*MOD(K1;7)+6*MOD(19*MOD(K1;19)+24;30)+5;7)))-31))

This comment was minimized by the moderator on the site
Hello Tami,Thanks for your share. This formula does work without error on google sheets. Thanks!Sincerely,Mandy
This comment was minimized by the moderator on the site
Is there a similar Excel Formula to figure out the Chinese New Year since it's also a Lunar Calendar Holiday?
This comment was minimized by the moderator on the site
What about orthodox easter? Is there a code for that as well?
This comment was minimized by the moderator on the site
Also 2108 gives 2108-Mar-31, should be 2108-Apr-1.
This comment was minimized by the moderator on the site
I translated your formula for Dutch Excel like this (year in A81):
=AFRONDEN.BENEDEN(DATUM(A81;5;DAG(MINUUT(A81/38)/2+56));7)-34

The formula gives 2079-04-16 for Easter 2079. This should be 2079-04-23. The rest of the 21st century looks ok!
This comment was minimized by the moderator on the site
Yes I've had some problems with variations on that formula. Check 2011, 2038, 2052, and 2079, all 7 days early.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations