No of days in a year..?

  • Thread starter Thread starter Elijah
  • Start date Start date
E

Elijah

Hi,

I think I'm going dumb here - as I can't figure out how to calculate the
number of days in a year. For example if I have '2004' entered in a cell,
can anyone provide a simple function to return 366?

Elijah
 
Hi Elijah,

=DATE(A1+1,1,1)-DATE(A1,1,1)

assuming 2004 in A1

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hi,

I think I'm going dumb here - as I can't figure out how to calculate the
number of days in a year. For example if I have '2004' entered in a cell,
can anyone provide a simple function to return 366?

Elijah

Here's one way, with 2004 in A1:

=DATE(A1+1,1,1)-DATE(A1,1,1)


--ron
 
Here's another approach: Look for leap years.

Simple rule that breaks: =IF(MOD(year,4)=0,366,365)

All the rules, in order:
year < 1752 and mod(year,4) = 0 => leap year
mod(year,400) = 0 => leap year
mod(year,100) = 0 => !leap year
mod(year,4) = 0 => leap year

so:
=IF(OR(MOD(year,400)=0,AND(year<1752,MOD(year,4)=0),
AND(MOD(year,100)<>0,MOD(year,4))=0)),366,365)

2000 was a leap year, 1900 was not one and 2100 will not be one.

Elijah said:
Hi,

I think I'm going dumb here - as I can't figure out how to calculate the
number of days in a year. For example if I have '2004' entered in a cell,
can anyone provide a simple function to return 366?

Elijah

--
Email to (e-mail address removed) (yes, you can so figure it out) ;-]

Scream and shout and jump for joy! I was here before Kilroy!

Sorry to spoil your little joke. I was here but my computer broke. ---Kilroy
 
Back
Top