Spreadsheet Formulas

css navigation by Css3Menu.com

Find Leap Year

I needed to display the number of days for each month of the year along with their sales.

A year is divisible by 4 if it is a leap year and the century is divisible by 500. Since it will be a few years before we have a new century I simplified.

=IF(MOD(YEAR(NOW()),4)=0,29,28)

The MOD instruction takes 2 parameters. The number to be divided; in this case, the YEAR(NOW()) and the number to divide it by. The result is the remainder. When it is Ø, the month is in a Leap Year.

I sure prevented a bunch of other formula calisthenics.


© 2006-2024

Updated:  06/21/2024 07:42
This page added:  25 September 2006