Friday, October 23, 2009

Excel

I found myself with nothing to do this afternoon, which is always an unsettling feeling, so I decided that I was going to make a liturgical calender using Excel in these stretches of time. Actuaries use Excel alot, and it's a pretty nifty program to boot (which is probobly why they use it), so I figured I ought to know how to use it.

Well, as you know, Easter falls on a different day each year (anywhere from March 22 to April 25 in fact). The calculation actually has to do with the lunar cycle: "Easter day is the first Sunday after the 14th day of the lunar month (the nominal full moon) that falls on or after 21 March (nominally the day of the vernal equinox)." Needless to say it gets quite difficult. The other liturgical dates aren't nearly as difficult: the First Sunday in Advent, which is comming upon us quickly, is 4 Sundays before Christmas.

So I figured that it'd be best to tackle Easter first. I used dateofeaster.net (conveniant...) to figure out how it was actually done. I used a different column to calculate the letters for each year and when I got the finished column (the date of Easter) I opened up another handy Microsoft product, Word, and used the "Replace" function to consolidate my formula. Unfortunately Excel cut me off at 9000 characters for my formula, so I needed to use two columns and hide one (oh, but I will have victory one day). My formula was so long because of the steps where you need to determine the day of the week and then do different things for each day; I did this by determining the day of the week, and then having a different "if" statement for each day, which takes 7 times the charachters I think it really ought to. I also found a more simple algorithm by a certain Carl Friedrich Gauss. But after quickly figuring out the First Sunday in Advent (which took a measly 350 characters in comparison!) I'm calling it quits for today.

No comments: