In the first months of the Peltier Tech blog, I wrote an article about Calculating Easter, which is a complicated task. I shared a couple of worksheet formulas to calculate the date of Easter, then I posted two VBA UDFs (User Defined Functions) to compute Easter, one for “Western” Easter and the other for Orthodox Easter. Then I talked briefly about the differences between them.

Without much ado, I will show below two new Lambda functions that can replace the earlier VBA UDFs. It actually was easy to write the Lambdas; much easier than writing an old-school worksheet formula would be.

The VBA formulas were written by Norman Harker, based on Claus Tøndering’s article Easter. Another discussion can be found in the Pi Mu Epsilon Journal, Vol 9 No 6 (scroll down to page 374).

The Lambda formulas can be used like any others, entered as shown in a cell appended by a reference to the year of interest in parentheses, or by defining a Name with the Lambda formula as the Refers-To function. In Excel, the calculations are only valid for the years 1900 or later.

## Lambda to Compute Western Easter

```
=LAMBDA(yr,
LET(
G,MOD(yr,19),
C,INT(yr/100),
H,MOD(C-INT(C/4)-INT((8*C+13)/25)+19*G+15,30),
I,H-INT(H/28)*(1-INT(29/(H+1))*INT((21-G)/11)),
J,MOD(yr+INT(yr/4)+I+2-C+INT(C/4),7),
L,I-J,
EM,3+INT((L+40)/44),
ED,L+28-(31*INT(EM/4)),
DATE(yr,EM,ED))
)
```

## Lambda to Compute Eastern Orthodox Easter

```
=LAMBDA(yr,
LET(
G,MOD(yr,19),
I,MOD(19*G+15,30),
J,MOD(yr+INT(yr/4)+I,7),
L,I-J,
EM,3+INT((L+40)/44),
ED,L+28-(31*INT(EM/4)),
JulAdj,10+INT(yr/100)-16-INT(yr/400)+4,
DATE(yr,EM,ED)+JulAdj)
)
```

## Using a Lambda Formula in a Cell

You can use either of these formulas as is, adding any arguments in a list in parentheses after the Lambda. Our formulas have only one argument, the year, denoted as `yr`

at the beginning of the Lambdas. You could enter the argument as a numeric value or as a reference to a cell containing the value. To calculate Western Easter for this year, 2024, enter this into a cell:

```
=LAMBDA(yr,
LET(
G,MOD(yr,19),
C,INT(yr/100),
H,MOD(C-INT(C/4)-INT((8*C+13)/25)+19*G+15,30),
I,H-INT(H/28)*(1-INT(29/(H+1))*INT((21-G)/11)),
J,MOD(yr+INT(yr/4)+I+2-C+INT(C/4),7),
L,I-J,
EM,3+INT((L+40)/44),
ED,L+28-(31*INT(EM/4)),
DATE(yr,EM,ED))
)(2024)
```

To calculate Eastern Easter for a year entered into cell A1, enter this into a cell:

```
=LAMBDA(yr,
LET(
G,MOD(yr,19),
I,MOD(19*G+15,30),
J,MOD(yr+INT(yr/4)+I,7),
L,I-J,
EM,3+INT((L+40)/44),
ED,L+28-(31*INT(EM/4)),
JulAdj,10+INT(yr/100)-16-INT(yr/400)+4,
DATE(yr,EM,ED)+JulAdj)
)(A1)
```

## Using a Lambda Formula as a User Defined Function

The great flexibility of a Lambda formula is that you can enter it once, give it a Name, and use it anywhere in the workbook by that name.

On the Formulas tab of Excel’s ribbon, click on Define Name. In the dialog, enter a name for your formula (let’s use `WesternEaster`

). Enter any comment, such as “Input a year and calculate the date of Easter.” And in the Refers To box, enter the Lambda formula as shown above (without the trailing reference in parentheses). The dialog doesn’t give us the nice indented formula structure, but it still works fine.

Now you can use this anywhere in your workbook, in a cell or even in another formula, by entering it into a cell like one of these:

```
=WesternEaster(2024)
=WesternEaster(A1)
```

Couldn’t be easier.

## Revision: One Lambda to Compute Eastern or Western Easter

David suggested in the comments that having one Lambda function to compute Easter according to either calendar would be nice. The following Lambda takes two arguments, the year and a boolean which is True for Eastern Easter and False for Western Easter.

```
=LAMBDA(yr,Eastern,
LET(
G,MOD(yr,19),
C,if(eastern,0,INT(yr/100)),
H,if(eastern,0,MOD(C-INT(C/4)-INT((8*C+13)/25)+19*G+15,30)),
I,if(eastern,MOD(19*G+15,30),H-INT(H/28)*(1-INT(29/(H+1))*INT((21-G)/11))),
J,MOD(yr+INT(yr/4)+I+if(eastern,0,2-C+INT(C/4)),7),
L,I-J,
EM,3+INT((L+40)/44),
ED,L+28-(31*INT(EM/4)),
JulAdj,if(eastern,10+INT(yr/100)-16-INT(yr/400)+4,0),
DATE(yr,EM,ED)+JulAdj)
)
```

When used in a cell, the formula would look like this:

```
=LAMBDA(yr,Eastern,
LET(
G,MOD(yr,19),
C,if(eastern,0,INT(yr/100)),
H,if(eastern,0,MOD(C-INT(C/4)-INT((8*C+13)/25)+19*G+15,30)),
I,if(eastern,MOD(19*G+15,30),H-INT(H/28)*(1-INT(29/(H+1))*INT((21-G)/11))),
J,MOD(yr+INT(yr/4)+I+if(eastern,0,2-C+INT(C/4)),7),
L,I-J,
EM,3+INT((L+40)/44),
ED,L+28-(31*INT(EM/4)),
JulAdj,if(eastern,10+INT(yr/100)-16-INT(yr/400)+4,0),
DATE(yr,EM,ED)+JulAdj)
)(2024,TRUE)
```

When defined as the name `Easter`

in the Define Name dialog, it would be used like this:

`=Easter(2024,TRUE)`

Thanks for the great suggestion, David!

Thanks says

Jon,

It would be helpful to readers to highlight some of the challenges that arise when trying to calculate Easter, and take a moment to explain what the functions are doing. Also, how the Lambda might be different than traditional VBA approaches.

Jon Peltier says

Thanks for your reply.

Rather than rehashing discussions about the difficulties of calculating Easter, since I’m by no means an expert, I thought the two links I provided could satisfy anyone’s curiosity.

The 16-year-old article from my blog has VBA equivalent functions. I simply modified their syntax to match that of Excel’s formula engine to generate my Lambdas. When used as Named Formulas, the Lambda implementation feels identical to that of VBA UDFs.

David N says

One additional idea would be to create the custom LAMBDA with an optional argument — perhaps something like [orthodox] that could be used as a TRUE / FALSE — and subsequent IF logic so that a single function could contain both calculations and be used to return the Western or Eastern date based upon the user’s choice.

Jon Peltier says

Thanks for the great suggestion, David. I’ve appended the combined formula to this article.