Easter day formula
Could it be that the month/day sequence is different where it's not working?
I'd be interested in seeing entire the working solution. I did some VBA
code to calculate Easter and it seems to me that all I've seen points to the
solution being a bit more complex than that. Maybe I'm wrong?
Here's code for a UDF that will calculate Easter Sunday for any year after
1582.
Call it by passing a year or the address of a cell with the year in it, as
=NewDetermineEasterSunday(2007)
or
=NewDetermineEasterSunday(A1)
Function NewDetermineEasterSunday(anyYear As Variant) As Variant
'Determine Easter Sunday for any year after 1583
'INPUT: The Year
'OUTPUT: a DateSerial value that can be used to display
'the date in any format chosen by the end user
'ERROR OUTPUT: "Invalid Year" will be returned if an
'invalid input is provided.
'note, integer math (\ vs /) is critical to accurate results
'extra care has been made in places to assure integer math
'is performed thoughout the process
'
Dim anyYearValue As Variant
Dim myYear As Integer
Dim Century As Integer
Dim GoldenNumber As Integer
Dim GregorianFix As Integer
Dim ClavianFix As Integer
Dim Epact As Integer
Dim FindSundays As Integer
Dim DaysIntoMarch As Integer
anyYearValue = Val(anyYear)
If Int(anyYearValue) < anyYearValue Then
NewDetermineEasterSunday = "Invalid Year"
Exit Function
End If
If anyYearValue < 1583 Then
NewDetermineEasterSunday = "Invalid Year"
Exit Function
End If
myYear = Int(anyYearValue) ' move to working integer value
Century = (myYear \ 100) + 1
GregorianFix = ((3 * Century) \ 4) - 12
GoldenNumber = (myYear Mod 19) + 1
ClavianFix = ((8 * Century + 5) \ 25) - 5 - GregorianFix
FindSundays = ((5 * myYear) \ 4) - GregorianFix - 10 '************
Epact = Int((Int(11 * GoldenNumber) + 20 + ClavianFix)) Mod 30
If Epact < 25 Then
If GoldenNumber 11 Then
Epact = Epact + 1
End If
End If
If Epact = 24 Then
Epact = Epact + 1
End If
DaysIntoMarch = 44 - Epact
If DaysIntoMarch <= 20 Then
DaysIntoMarch = DaysIntoMarch + 30
End If
DaysIntoMarch = (DaysIntoMarch + 7) - ((DaysIntoMarch + FindSundays) Mod
7)
NewDetermineEasterSunday = DateSerial(myYear, 3, DaysIntoMarch)
End Function
Some test cases:
1943/2049: April 25
1981: April 19
1984: April 15
2285: March 22
4200: April 20
2007: April 8
"Antonio Atala" wrote:
easter day formula excel Sample Spreadsheets in spanish
'=FLOOR(DAY(MINUTE(IJ20/38)/2+56)&"/5/"&IJ20,7)-34
'=FRANC((JOUR(MINUTE(A1/38)/2+55)&"/4/"&A1)/7;)*7-6
This is what i got but does not work in spanish
|