+ Reply to Thread
Results 1 to 9 of 9

how many leap days between two dates

  1. #1
    Registered User
    Join Date
    10-31-2019
    Location
    Montreal
    MS-Off Ver
    2016
    Posts
    19

    how many leap days between two dates

    Hi friends,

    I am trying to find how many leap days (February 29) between two dates.

    The result has to be a number that I will use in another calculation.

    Could you please help.

    Thank you,
    Claudia

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: how many leap days between two dates

    If lower date is in A1 and Second date is in B1 then Maybe

    =INT((YEAR(B1)-1920)/4)-INT((YEAR(A1)-1920)/4)+IF(AND(MOD(2020,4)=0,B1>=B1),1,0)
    Last edited by mehmetcik; 03-05-2020 at 07:28 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    10-31-2019
    Location
    Montreal
    MS-Off Ver
    2016
    Posts
    19

    Re: how many leap days between two dates

    Hi mehmetcik,

    thanks a lot for your help, but I have just tried it between 9-Jan-2012 10-Jan-2016 and it gave 2 days.

    Please let me know how to fix.

    Thanks again

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,656

    Re: how many leap days between two dates

    Try:
    Please Login or Register  to view this content.
    Quang PT

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,656

    Re: how many leap days between two dates

    Hi, forget my solution in #4, it does not work with 2 date in same year.
    Try below:
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: how many leap days between two dates

    Sorry Error crept in while I was testing

    =INT((YEAR(B1)-1920)/4)-INT((YEAR(A1)-1920)/4)+IF(AND(MOD(YEAR(B1),4)=0,B1>=DATEVALUE("29/02/" &YEAR(B1))),1,0)

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,742

    Re: how many leap days between two dates

    Withdrawn by FR.

    Didn't work.
    Last edited by FlameRetired; 03-06-2020 at 12:00 AM.
    Dave

  8. #8
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: how many leap days between two dates

    =SUMPRODUCT((MOD(YEAR(ROW(INDIRECT(A1&":"&A2))),4)=0)*(DAY(ROW(INDIRECT(A1&":"&A2)))=29)*(MONTH(ROW(INDIRECT(A1&":"&A2)))=2))

    expanding the logic for how many Mondays https://exceljet.net/formula/count-d...-between-dates


    post 5 is a better answer
    Last edited by davsth; 03-06-2020 at 05:32 AM.

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,466

    Re: how many leap days between two dates

    Quote Originally Posted by bebo021999 View Post
    Hi, forget my solution in #4, it does not work with 2 date in same year.
    Try below:
    Please Login or Register  to view this content.
    The INDIRECT function is Volatile so if the OP needs to use this formula in a large amount of cells, then maybe this non-Volatile version of your formula would work better for such a case...

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Rick Rothstein; 03-06-2020 at 08:27 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formulate LEAP yr to be 365 days in excel
    By forest06 in forum Excel General
    Replies: 4
    Last Post: 05-12-2012, 05:12 AM
  2. Calculating number of days in leap year
    By raw_geek in forum Excel General
    Replies: 9
    Last Post: 03-16-2012, 11:39 AM
  3. Dates and Leap Years
    By JEA in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-05-2011, 11:03 PM
  4. Difference in dates but leap year problem
    By FCFalkirk in forum Excel General
    Replies: 3
    Last Post: 03-03-2011, 01:57 PM
  5. Finding Leap Year between 2 dates
    By Boomerj2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-16-2010, 09:52 AM
  6. List of days without leap year
    By craigafrica in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-29-2008, 09:26 AM
  7. [SOLVED] Calculating Dates from Non Leap Seconds
    By Mac Lingo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2005, 11:05 PM
  8. Calculating days between dates and leap years
    By KimberlyC in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 03-17-2005, 12:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1