If statement in Excel to recognize a leap year
How could I write 开发者_如何学JAVAa If statement in Excel to divide a cell by 2088 if it is a leap year, and if it is not a leap year divide the same cell by 2080?
If you put this in A2:
=IF(OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)<>0)),2088, 2080)
And then put the year you care about in A1 and your value in B1 and then do:
=B1/A2
See this Technet article for further info (I used the IF statement from there as a base).
Edit: Or do you mean that you want to divide the year by that value? If so add the following in any cell but A1:
=IF(OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)<>0)), A1 / 2088, A1 / 2080)
And put the year in A1.
In GREGORIAN CALENDAR most years which are multiple of 4 are leap years. But three leap years are omitted every 400 years. So in order to be a leap year, the year should be divisible by 4 except the centennial years, which are not divisible by 400. for eg. 2000 was a leap year but 2100,2200 and 2300 will not be.
And to be more precise check this link http://support.microsoft.com/kb/214019
精彩评论