+ Reply to Thread
Results 1 to 17 of 17

Count numbers of days between dates in specific year

  1. #1
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Count numbers of days between dates in specific year

    Hi

    What the easiest formula to count numbers between two dates ( only days in specific year )
    A1: FROM
    A2: TO
    A3: The required year
    kindly explain the formula
    Attached Files Attached Files
    Last edited by Undo; 01-14-2022 at 11:49 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Count numbers of days between dates in specific year

    There are instructions at the top of the page on how to post a sample sheet.Thanks

  3. #3
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: Count numbers of days between dates in specific year

    Uploaded...

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,002

    Re: Count numbers of days between dates in specific year

    This is what you need:

    =MIN(A3,DATE(A4,12,31))-MAX(A2,DATE(A4,1,1))+1
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,002

    Re: Count numbers of days between dates in specific year

    or... using the ranges in your sample:

    =MIN(B2,DATE(E2,12,31))-MAX(A2,DATE(E2,1,1))+1

  6. #6
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: Count numbers of days between dates in specific year

    Thank you, Thats working!
    if anyone have shorter and easier formula kindly share it with us

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Count numbers of days between dates in specific year

    What is difficult about that formula? And I don't think it can be shortened

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,002

    Re: Count numbers of days between dates in specific year

    It's not that difficult!!

    MIN(B2,DATE(E2,12,31)) returns the 31/12 of the chosen year, or the value in B2... whichever is lower.

    MAX(A2,DATE(E2,1,1)) returns the 1/1 of the chosen year, or the value in A1... whichever is higher.

    The two are then substracted, one from the other and 1 is added to give the correct answer.



    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  9. #9
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: Count numbers of days between dates in specific year

    Quote Originally Posted by Pepe Le Mokko View Post
    ... I don't think it can be shortened
    Yes, it can ;-)

    =MIN(B2,E2&"-12-31")-MAX(A2,E2&"-1-1")+1

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,002

    Re: Count numbers of days between dates in specific year

    Nice one Root. Are you a believer in boasting that "Mine's shorter than yours"??

    (Will I get an infraction for that comment, I wonder??!!)

  11. #11
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: Count numbers of days between dates in specific year

    Boasting? - Definitely no.

    Rather a believer that people learn neat Excel tricks by looking at what others are doing. At least, that's how I've been learning

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Count numbers of days between dates in specific year

    Me, too - proper magpie, me.

    (Will I get an infraction for that comment, I wonder??!!)
    LOL!!!
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,002

    Re: Count numbers of days between dates in specific year

    Hahaha. To whom it may concern...

    You steal from me, but I steal from everybody.

  14. #14
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: Count numbers of days between dates in specific year

    =SUBSTITUTE(^^^,"steal","learn")
    Thank you for the rep points, Glenn!

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,002

    Re: Count numbers of days between dates in specific year

    You're welcome... it saved a total of (i recall) just 4 characters, but it was novel (to me, anyway).

  16. #16
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: Count numbers of days between dates in specific year

    To me, length is of a second importance (can you believe this???). The beauty is in reducing the number of function calls and reference calls.

  17. #17
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,002

    Re: Count numbers of days between dates in specific year

    Time to stop... otherwise, I'll have to give us both an infraction...

+ 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. Count number of days between dates in selected year
    By Undo in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-14-2021, 01:04 PM
  2. [SOLVED] Count number of days between dates in last two year
    By Undo in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-14-2021, 11:52 AM
  3. [SOLVED] Count days between two dates, split by year
    By marcandrecote in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-11-2019, 06:41 PM
  4. [SOLVED] Function for counting days between 2 dates for specific year
    By erthmill in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-09-2016, 04:14 PM
  5. [SOLVED] Function for counting days between 2 dates for specific year
    By erthmill in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-09-2016, 12:58 PM
  6. Replies: 2
    Last Post: 12-17-2013, 06:30 AM
  7. [SOLVED] Count days for specific year falling within in multi-year date range
    By jslo2013 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-04-2012, 05:58 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