+ Reply to Thread
Results 1 to 4 of 4

Assistance in updating formula for DATE functions - eg DateValue, Day, etc, for Leap Years

  1. #1
    Registered User
    Join Date
    04-15-2013
    Location
    Australia
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    57

    Assistance in updating formula for DATE functions - eg DateValue, Day, etc, for Leap Years

    To Whom It May Concern

    I write to seek assistance in writing a formula for recognising and adjusting "DATE"-based formulas to include adjustments for Leap Years, please.

    Please find attached an example spreadsheet of how I intend to use it.
    Please note, Sheet Name: "Income & Cash or Debit Expenses", is the PRIMARY sheet; Cell A3, "Home and Utilities Sheet", is LINKED to the previous sheet.

    "(IF(DAY('[Sheet Name]'!$A$3)<>365," etc, this refers to the number of days in a year (obviously); could anyone please show me how to write a formula that will automatically calculate and adjust for "leap years", ie 29 February 2024, 29 February 2028, 29 February 2032, and so on...

    Please ignore:

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    and

    #REF!

    Thank you, Matthew Hinds.
    Attached Files Attached Files
    Last edited by matthewhinds; 02-20-2023 at 10:54 PM.

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Assistance in updating formula for DATE functions - eg DateValue, Day, etc, for Leap Y

    try Power Query function:
    Please Login or Register  to view this content.
    result will be TRUE or FALSE
    eg.
    Date LeapYear
    21/02/2017
    FALSE
    21/02/2018
    FALSE
    21/02/2019
    FALSE
    21/02/2020
    TRUE
    21/02/2021
    FALSE
    21/02/2022
    FALSE
    21/02/2023
    FALSE
    21/02/2024
    TRUE
    21/02/2025
    FALSE
    21/02/2026
    FALSE
    21/02/2027
    FALSE
    21/02/2028
    TRUE
    21/02/2029
    FALSE
    21/02/2030
    FALSE
    21/02/2031
    FALSE
    21/02/2032
    TRUE
    21/02/2033
    FALSE
    21/02/2034
    FALSE
    21/02/2035
    FALSE
    21/02/2036
    TRUE
    21/02/2037
    FALSE
    21/02/2038
    FALSE
    21/02/2039
    FALSE
    21/02/2040
    TRUE
    21/02/2041
    FALSE
    21/02/2042
    FALSE

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,407

    Re: Assistance in updating formula for DATE functions - eg DateValue, Day, etc, for Leap Y

    Similar to sandy's but with formula.


    A
    B
    C
    1
    1/1/1999
    FALSE
    In B1: =ISODD(MATCH(0,MOD(YEAR(A1),{400,100,4,1}),0))
    2
    1/1/2000
    TRUE
    3
    1/1/2001
    FALSE
    4
    1/1/2002
    FALSE
    5
    1/1/2003
    FALSE
    6
    1/1/2004
    TRUE
    7
    1/1/2005
    FALSE
    8
    1/1/2006
    FALSE
    9
    1/1/2007
    FALSE
    10
    1/1/2008
    TRUE
    11
    1/1/2009
    FALSE
    12
    1/1/2010
    FALSE
    13
    1/1/2011
    FALSE
    14
    1/1/2012
    TRUE
    15
    1/1/2013
    FALSE
    16
    1/1/2014
    FALSE
    17
    1/1/2015
    FALSE
    Dave

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,625

    Re: Assistance in updating formula for DATE functions - eg DateValue, Day, etc, for Leap Y

    IF(DAY('[Sheet Name]'!$A$3) gives the day of month. How it is compared to 365 is not clear.
    If you want the last day of February in C3
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

+ 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. VBA - Updating dates on a spreadsheet but issue with leap years
    By oliverh1993 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2022, 04:45 PM
  2. [SOLVED] How to subtract date while getting output considering leap years
    By jake29 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-06-2021, 02:11 PM
  3. leap years and date calculation
    By Alaxus in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-16-2020, 09:34 AM
  4. [SOLVED] Age based on DOB; Accounts for leap years. Years old if >2, Months if <2 years old.
    By sharpmel in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-17-2013, 04:20 PM
  5. Date Differences and ignoring Leap Years
    By kieran54055 in forum Excel General
    Replies: 2
    Last Post: 09-20-2010, 11:51 AM
  6. Excel =Date and Leap Years
    By thesonofdarwin in forum Excel General
    Replies: 10
    Last Post: 06-15-2010, 03:31 AM
  7. Problem with displaying a date range for leap years
    By Parmo in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-02-2007, 06:27 PM

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