Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default IF formula to allow Feb 29th in a leap year

I know the rule that a leap year has to be divisable by 400 or divisable by 4
& 100 but I can't figure out how to put it in a IF formaula. Can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default IF formula to allow Feb 29th in a leap year

This formula decides if a year is leap year or not:
=IF(MONTH(DATE(A15,2,29))=2,"leap","not leap")

Regards,
Stefi

€˛Mike M.€¯ ezt Ć*rta:

I know the rule that a leap year has to be divisable by 400 or divisable by 4
& 100 but I can't figure out how to put it in a IF formaula. Can anyone help?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default IF formula to allow Feb 29th in a leap year

On Tue, 24 Feb 2009 06:18:09 -0800, Mike M.
wrote:

I know the rule that a leap year has to be divisable by 400 or divisable by 4
& 100 but I can't figure out how to put it in a IF formaula. Can anyone help?


Depending on your purpose for doing this, the following might suffice (for
every valid Excel year except 1900):

=IF(DAY(DATE(A1,2,29))=29,"Leap Year","Not Leap Year")
--ron
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default IF formula to allow Feb 29th in a leap year

Both I and Ron forgot to mention that A15 or A1 refer to a cell cotaining
year number.
Stefi


€˛Ron Rosenfeld€¯ ezt Ć*rta:

On Tue, 24 Feb 2009 06:18:09 -0800, Mike M.
wrote:

I know the rule that a leap year has to be divisable by 400 or divisable by 4
& 100 but I can't figure out how to put it in a IF formaula. Can anyone help?


Depending on your purpose for doing this, the following might suffice (for
every valid Excel year except 1900):

=IF(DAY(DATE(A1,2,29))=29,"Leap Year","Not Leap Year")
--ron

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default IF formula to allow Feb 29th in a leap year

Hi Mike

Supposing the year is in cell A1, use the following formula:-
=IF(MOD(A1,4)=0,"leap year","Not leap")

If you want to check a date automatically, if that date belongs to a Leap
year or NOT, then try following formula.

=IF(MOD(YEAR(TODAY()),4)=0,"leap year","Not leap")

Let me know if it helps. Thanks.

--
Dilip Kumar Pandey
MBA, BCA, B.Com(Hons.)


New Delhi, India


"Mike M." wrote:

I know the rule that a leap year has to be divisable by 400 or divisable by 4
& 100 but I can't figure out how to put it in a IF formaula. Can anyone help?



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default IF formula to allow Feb 29th in a leap year

No. It doesn't help, Dilip. What does that give for the year 2100, or
2200? Those are NOT leap years.
If you go down that line you'd need something like
=IF(OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)< 0)),"leap year","Not
leap")
--
David Biddulph

"DILipandey" wrote in message
...
Hi Mike

Supposing the year is in cell A1, use the following formula:-
=IF(MOD(A1,4)=0,"leap year","Not leap")

If you want to check a date automatically, if that date belongs to a Leap
year or NOT, then try following formula.

=IF(MOD(YEAR(TODAY()),4)=0,"leap year","Not leap")

Let me know if it helps. Thanks.

--
Dilip Kumar Pandey
MBA, BCA, B.Com(Hons.)


New Delhi, India


"Mike M." wrote:

I know the rule that a leap year has to be divisable by 400 or divisable
by 4
& 100 but I can't figure out how to put it in a IF formaula. Can anyone
help?



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default IF formula to allow Feb 29th in a leap year

Technically, you are right... and I was going to respond the same way as you
did, but changed my mind at the last moment figuring that 2100 and 2200 was
far enough into the future that it probably wouldn't be an issue in 99.99%
of any user's applications.

--
Rick (MVP - Excel)


"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
No. It doesn't help, Dilip. What does that give for the year 2100, or
2200? Those are NOT leap years.
If you go down that line you'd need something like
=IF(OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)< 0)),"leap year","Not
leap")
--
David Biddulph

"DILipandey" wrote in message
...
Hi Mike

Supposing the year is in cell A1, use the following formula:-
=IF(MOD(A1,4)=0,"leap year","Not leap")

If you want to check a date automatically, if that date belongs to a Leap
year or NOT, then try following formula.

=IF(MOD(YEAR(TODAY()),4)=0,"leap year","Not leap")

Let me know if it helps. Thanks.

--
Dilip Kumar Pandey
MBA, BCA, B.Com(Hons.)


New Delhi, India


"Mike M." wrote:

I know the rule that a leap year has to be divisable by 400 or divisable
by 4
& 100 but I can't figure out how to put it in a IF formaula. Can anyone
help?




  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default IF formula to allow Feb 29th in a leap year

Another test to add to the pile...

=IF(ISERR(--("29-Feb-"&B1)),"Not Leap","Leap")

--
Rick (MVP - Excel)


"Mike M." wrote in message
...
I know the rule that a leap year has to be divisable by 400 or divisable by
4
& 100 but I can't figure out how to put it in a IF formaula. Can anyone
help?


  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,059
Default IF formula to allow Feb 29th in a leap year

On Feb 24, 6:18*am, Mike M. wrote:
I know the rule that a leap year has to be divisable
by 400 or divisable by 4 & 100 but I can't figure out
how to put it in a IF formaula. Can anyone help?


If you are specifically looking for an IF() expression with that logic
(for example, to learn how to nest "OR" and "AND" conditions):

=IF(OR(MOD(A1,400)=0,AND(MOD(A1,100),MOD(A1,4)=0)) ,"leap","")

Alternatively:

=IF((MOD(A1,400)=0)+(MOD(A1,100)<0)*(MOD(A1,4)=0) ,"leap","")

PS: That works just fine for 1900, of course, whereas DATE-based
expressions does not (surprise!).
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,389
Default IF formula to allow Feb 29th in a leap year

With your year in A1, the following will be True if it is a leap year, and
False if it's not:
=OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)<0))

It works for years 1900 and prior whereas Excel's date function will not.

Regards,
Fred.

"Mike M." wrote in message
...
I know the rule that a leap year has to be divisable by 400 or divisable by
4
& 100 but I can't figure out how to put it in a IF formaula. Can anyone
help?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change the following formula to allow for leap year Linda432 Excel Discussion (Misc queries) 3 June 11th 08 02:29 PM
Leap Year Jet Excel Discussion (Misc queries) 3 March 20th 08 04:17 PM
leap year p-nut Excel Discussion (Misc queries) 5 January 10th 08 05:34 AM
Leap Year Ralph Page Charts and Charting in Excel 3 November 5th 07 01:57 AM
How to determine if year is a leap year Wanda Excel Worksheet Functions 7 September 17th 07 07:48 AM


All times are GMT +1. The time now is 08:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"