close

Is there a function to indicate if the YEAR of a given date is a leap year.
eg. 21 Mar 2004 = 1
21 Mar 2003 = 0
Thank you
--
Robert

One way

=--(DAY(DATE(YEAR(A1),3,0))=29)

assuming the date starts in A1 copy down

--

Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
quot;It is a good thing to follow the first law of holes;
if you are in one stop digging.quot; Lord Healeyquot;Robertquot; gt; wrote in message
...
gt; Is there a function to indicate if the YEAR of a given date is a leap
gt; year.
gt; eg. 21 Mar 2004 = 1
gt; 21 Mar 2003 = 0
gt; Thank you
gt; --
gt; Robert

=IF(((YEAR(D2)/4)-(INT(YEAR(D2)/4)))gt;0,1,0)
--
Robert

But that's the opposite to what you posted

21 Mar 2004 = 1
21 Mar 2003 = 0

--

Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
quot;It is a good thing to follow the first law of holes;
if you are in one stop digging.quot; Lord Healeyquot;Robertquot; gt; wrote in message
news
gt;
gt; =IF(((YEAR(D2)/4)-(INT(YEAR(D2)/4)))gt;0,1,0)
gt; --
gt; Robert
gt;
gt;
gt;
Thanks Peo for pointing the mistake. In view of Article ID21436 in MS Help
and Support, I shall adopt yours.
--
Robert

quot;Peo Sjoblomquot; gt; wrote in message
...

gt; quot;Robertquot; gt; wrote in message
gt; news
gt;gt;
gt;gt; =IF(((YEAR(D2)/4)-(INT(YEAR(D2)/4)))gt;0,1,0)

gt; But that's the opposite to what you posted
gt;
gt; 21 Mar 2004 = 1
gt; 21 Mar 2003 = 0

And even having corrected that, the formula is wrong. 1600 and 2000 were
leap years, but 1700, 1800, and 1900 weren't and 2100 won't be.
--
David Biddulph

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()