C
Chuck
Is there an equation that will calculate the phases of the moon?
Chuck
Chuck
I don't think that the formula calculates anything about the full moon - it is most likely that the
pattern of Easter Sundays fit some other discernable pattern (which I certainly cannot figure out).
But setting one full moon should be able to predict full moons many years into the future or past -
with a slight modification, the code correctly return the moon dates in 1901.
From the same contest that gave that function:
=TRUNC(DATE(J,7,-CODE(MID("NYdQ\JT_LWbOZeR]KU`",MOD(J,19)+1,1)))/7)*7+8
where J is the year...
But this VBA Function may give you a better idea of how the math is done:
Function EASTER(Yr As Integer) As Long
Dim Century As Integer
Dim Sunday As Integer
Dim Epact As Integer
Dim Golden As Integer
Dim LeapDayCorrection As Integer
Dim SynchWithMoon As Integer
Dim N As Integer
Golden = (Yr Mod 19) + 1
Century = Yr \ 100 + 1
LeapDayCorrection = 3 * Century \ 4 - 12
SynchWithMoon = (8 * Century + 5) \ 25 - 5
Sunday = 5 * Yr \ 4 - LeapDayCorrection - 10
Epact = (11 * Golden + 20 + SynchWithMoon - LeapDayCorrection) Mod 30
If Epact < 0 Then Epact = Epact + 30
If (Epact = 25 And Golden > 11) Or Epact = 24 Then Epact = Epact + 1
N = 44 - Epact
If N < 21 Then N = N + 30
N = N + 7 - ((Sunday + N) Mod 7)
EASTER = DateSerial(Yr, 3, N)
End Function
HTH,
Bernie
MS Excel MVP
I don't think that the formula calculates anything about the full moon - it is most likely that the
pattern of Easter Sundays fit some other discernable pattern (which I certainly cannot figure out).
But setting one full moon should be able to predict full moons many years into the future or past -
with a slight modification, the code correctly return the moon dates in 1901.
From the same contest that gave that function:
=TRUNC(DATE(J,7,-CODE(MID("NYdQ\JT_LWbOZeR]KU`",MOD(J,19)+1,1)))/7)*7+8
where J is the year...
But this VBA Function may give you a better idea of how the math is done:
Function EASTER(Yr As Integer) As Long
Dim Century As Integer
Dim Sunday As Integer
Dim Epact As Integer
Dim Golden As Integer
Dim LeapDayCorrection As Integer
Dim SynchWithMoon As Integer
Dim N As Integer
Golden = (Yr Mod 19) + 1
Century = Yr \ 100 + 1
LeapDayCorrection = 3 * Century \ 4 - 12
SynchWithMoon = (8 * Century + 5) \ 25 - 5
Sunday = 5 * Yr \ 4 - LeapDayCorrection - 10
Epact = (11 * Golden + 20 + SynchWithMoon - LeapDayCorrection) Mod 30
If Epact < 0 Then Epact = Epact + 30
If (Epact = 25 And Golden > 11) Or Epact = 24 Then Epact = Epact + 1
N = 44 - Epact
If N < 21 Then N = N + 30
N = N + 7 - ((Sunday + N) Mod 7)
EASTER = DateSerial(Yr, 3, N)
End Function
HTH,
Bernie
MS Excel MVP
I noticed that in
the VB Editor it doesn't seem to mater if \ of / is used as a division
indicator. I changed it in one place and the code still ran properly.
Chuck said:Bernie,
I'm not smart enough to follow what the function is doing. I noticed that in
the VB Editor it doesn't seem to mater if \ of / is used as a division
indicator. I changed it in one place and the code still ran properly. I
thought that possible "SynchWithMoon" might show some relationship to the date
of the full moon before Easter. If it does, I can't discern it.
As a side note, Easter can fall on any Sunday from March 22 to April 25.
Thanks for your help. I can still use your equations to calculate full moons
in relation to the known date of any one full moon.
Chuck
I don't think that the formula calculates anything about the full moon - it is most likely that
the
pattern of Easter Sundays fit some other discernable pattern (which I certainly cannot figure
out).
But setting one full moon should be able to predict full moons many years into the future or
past -
with a slight modification, the code correctly return the moon dates in 1901.
From the same contest that gave that function:
=TRUNC(DATE(J,7,-CODE(MID("NYdQ\JT_LWbOZeR]KU`",MOD(J,19)+1,1)))/7)*7+8
where J is the year...
But this VBA Function may give you a better idea of how the math is done:
Function EASTER(Yr As Integer) As Long
Dim Century As Integer
Dim Sunday As Integer
Dim Epact As Integer
Dim Golden As Integer
Dim LeapDayCorrection As Integer
Dim SynchWithMoon As Integer
Dim N As Integer
Golden = (Yr Mod 19) + 1
Century = Yr \ 100 + 1
LeapDayCorrection = 3 * Century \ 4 - 12
SynchWithMoon = (8 * Century + 5) \ 25 - 5
Sunday = 5 * Yr \ 4 - LeapDayCorrection - 10
Epact = (11 * Golden + 20 + SynchWithMoon - LeapDayCorrection) Mod 30
If Epact < 0 Then Epact = Epact + 30
If (Epact = 25 And Golden > 11) Or Epact = 24 Then Epact = Epact + 1
N = 44 - Epact
If N < 21 Then N = N + 30
N = N + 7 - ((Sunday + N) Mod 7)
EASTER = DateSerial(Yr, 3, N)
End Function
HTH,
Bernie
MS Excel MVP
Chuck said:Burnie,
I have an equation that accepts an input of a year (2009) and from this single
input it calculates the Month and Day for Easter of that year.
=FLOOR("5/"&DAY(MINUTE(YEAR({year})/38)/2+56)&"/"&YEAR({year}),7)-34
It is not my equation. It is something I found on the internet a fair number
of years ago. Since Easter is the first Sunday after the first full moon on or
after the Vernal Equinox (March 21), the equation some how calculates the date
for at least one full moon. I've tried to 'pull out' that full moon date. But
I'm just not smart enough.. If the date of that full moon can be had from a
single equation, that date can be the reference date to calculate full moons
for the rest of the year using you subroutine.
--
Chuck
Chuck,
There is a page at the Naval Observatory:
http://aa.usno.navy.mil/data/docs/MoonPhase.php#y2009
I just picked two from early this year, and adjusted UTC to EST.
HTH,
Bernie
MS Excel MVP
Chuck,
I noticed that in
the VB Editor it doesn't seem to mater if \ of / is used as a division
indicator. I changed it in one place and the code still ran properly.
In VBA, / is regular division, and \ is integer division (the same as using INT(x/y))
Try this:
Msgbox 3/2 & " " 3\2
Changing between the two will not affect the code's ability to run, but it will affect the result.
HTH,
Bernie
MS Excel MVP
Chuck said:Bernie,
I'm not smart enough to follow what the function is doing. I noticed that in
the VB Editor it doesn't seem to mater if \ of / is used as a division
indicator. I changed it in one place and the code still ran properly. I
thought that possible "SynchWithMoon" might show some relationship to the date
of the full moon before Easter. If it does, I can't discern it.
As a side note, Easter can fall on any Sunday from March 22 to April 25.
Thanks for your help. I can still use your equations to calculate full moons
in relation to the known date of any one full moon.
Chuck
I don't think that the formula calculates anything about the full moon - it is most likely that
the
pattern of Easter Sundays fit some other discernable pattern (which I certainly cannot figure
out).
But setting one full moon should be able to predict full moons many years into the future or
past -
with a slight modification, the code correctly return the moon dates in 1901.
From the same contest that gave that function:
=TRUNC(DATE(J,7,-CODE(MID("NYdQ\JT_LWbOZeR]KU`",MOD(J,19)+1,1)))/7)*7+8
where J is the year...
But this VBA Function may give you a better idea of how the math is done:
Function EASTER(Yr As Integer) As Long
Dim Century As Integer
Dim Sunday As Integer
Dim Epact As Integer
Dim Golden As Integer
Dim LeapDayCorrection As Integer
Dim SynchWithMoon As Integer
Dim N As Integer
Golden = (Yr Mod 19) + 1
Century = Yr \ 100 + 1
LeapDayCorrection = 3 * Century \ 4 - 12
SynchWithMoon = (8 * Century + 5) \ 25 - 5
Sunday = 5 * Yr \ 4 - LeapDayCorrection - 10
Epact = (11 * Golden + 20 + SynchWithMoon - LeapDayCorrection) Mod 30
If Epact < 0 Then Epact = Epact + 30
If (Epact = 25 And Golden > 11) Or Epact = 24 Then Epact = Epact + 1
N = 44 - Epact
If N < 21 Then N = N + 30
N = N + 7 - ((Sunday + N) Mod 7)
EASTER = DateSerial(Yr, 3, N)
End Function
HTH,
Bernie
MS Excel MVP
Burnie,
I have an equation that accepts an input of a year (2009) and from this single
input it calculates the Month and Day for Easter of that year.
=FLOOR("5/"&DAY(MINUTE(YEAR({year})/38)/2+56)&"/"&YEAR({year}),7)-34
It is not my equation. It is something I found on the internet a fair number
of years ago. Since Easter is the first Sunday after the first full moon on or
after the Vernal Equinox (March 21), the equation some how calculates the date
for at least one full moon. I've tried to 'pull out' that full moon date. But
I'm just not smart enough.. If the date of that full moon can be had from a
single equation, that date can be the reference date to calculate full moons
for the rest of the year using you subroutine.
--
Chuck
Chuck,
There is a page at the Naval Observatory:
http://aa.usno.navy.mil/data/docs/MoonPhase.php#y2009
I just picked two from early this year, and adjusted UTC to EST.
HTH,
Bernie
MS Excel MVP
Bernie,Is there an equation that will calculate the phases of the moon?
Chuck
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.