Easter Date

S

Steved

Hello from Steved

The below can I add color to cell ie white background red
font
Thankyou.

Function EASTER(year As Single) As Date
'Based on Claus Tondering algorithm interpretation.
'See http://www.tondering.dk/claus/cal/node3
'Norman Harker 10-Jul-2004
Dim G As Integer: Dim C As Integer: Dim H As Integer
Dim I As Integer: Dim J As Integer: Dim L As Integer
Dim EM As Integer: Dim ED As Integer
Dim Adj1904 As Integer
G = year Mod 19
C = Int(year / 100)
H = (C - Int(C / 4) - Int((8 * C + 13) / 25) + 19 * G +
15) Mod 30
I = H - Int(H / 28) * (1 - Int(29 / (H + 1)) * Int((21 -
G) / 11))
J = (year + Int(year / 4) + I + 2 - C + Int(C / 4)) Mod 7
L = I - J
EM = 3 + Int((L + 40) / 44)
ED = L + 28 - 31 * Int(EM / 4)
If ActiveWorkbook.Date1904 = True Then
Adj1904 = 365 * 4 + 2
End If
EASTER = DateSerial(year, EM, ED) - Adj1904
End Function
 
N

Norman Harker

Hi Steved!

You can't do that with a function which is limited to returning a
value to a cell.

You'll need to use

Format > Conditional Formatting
Formula Is
Equal To
=A1=DATE(YEAR(A1),3,29.56+0.979*MOD(204-11*MOD(YEAR(A1),19),30)-WEEKDAY(DATE(YEAR(A1),3,28.56+0.979*MOD(204-11*MOD(YEAR(A1),19),30))))
Format Button
OK
OK

This is based upon the Gerhard Somitsch formula for Easter which
appears to work OK under both date systems up to and including 2203.
(So just duck out and look innocent after that date).
 
S

Steved

Thankyou Norman for the below format.

When I paste your formula in any Cell it works
but when I put it in My Calendar and use Conditional
Format, cell value is, "equal to" it will not work, but
when I use "less than or equal to" it will highlight the
2nd of March which is clearly wrong but I used this to
see if it would work, In this Case I am using the Year
2005

Any thoughts please.

=DATE(YEAR(A2),3,29.56+0.979*MOD(204-11*MOD(YEAR
(A2),19),30)-WEEKDAY(DATE(YEAR(A2),3,28.56+0.979*MOD(204-
11*MOD(YEAR(A2),19),30))))

Thankyou.
 
N

Norman Harker

Hi Steved!

I think I'll need to see this one. Send a copy to the address below.

It's a conditional format that will apply to a lot of Sundays /
Fridays / Mondays depending upon what holidays you are using.

My inclination is to put the formula or code for Easter in a hidden
cell and refer to that one.
 
S

Steved

Thanks Norman It's on it way

ps When you Email back to me please do not usec the Email
button on the Worksheet as I have not assigned a macro as
yet.

Thankyou.
 

Ask a Question

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.

Ask a Question

Top