Lewiy
Well-known Member
- Joined
- Jan 5, 2007
- Messages
- 4,284
I have come across this code for calculating the date of Easter on Chip Pearson's site: http://www.cpearson.com/excel/holidays.htm
The definition of the date for Easter is "The first Sunday after the first full moon on or after the vernal equinox".
Does anyone know how/why the above code works (cos it does!) and how on earth Excel can possibly know the phases of the moon!! This has been puzzling me for some time now.
Code:
Public Function EasterDate(Yr As Integer) As Date
Dim d As Integer
d = (((255 - 11 * (Yr Mod 19)) - 21) Mod 30) + 21
EasterDate = DateSerial(Yr, 3, 1) + d + (d > 48) + 6 - ((Yr + Yr \ 4 + _
d + (d > 48) + 1) Mod 7)
End Function
The definition of the date for Easter is "The first Sunday after the first full moon on or after the vernal equinox".
Does anyone know how/why the above code works (cos it does!) and how on earth Excel can possibly know the phases of the moon!! This has been puzzling me for some time now.