+ Reply to Thread
Results 1 to 10 of 10

Count days per month per year between 2 dates

  1. #1
    Registered User
    Join Date
    02-07-2023
    Location
    United States
    MS-Off Ver
    0.8
    Posts
    23

    Count days per month per year between 2 dates

    Hello. Hi!

    The problem is simple, but the answer doesn't seem so...

    I'm trying to count the number of days per month per year between two dates.

    So for the following 2 dates:

    2013.12.15
    2014.02.18
    I would have something like:

    Year | Month | Days

    2013 12 16

    2014 01 31

    2014 02 18

    So, with 2 dates, i would get as many rows as months between then.

    I would like to achieve this using only a Select statement, but am completelu lost.

    Anyone one out there can crack this? 😀

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

    Re: Count days per month per year between 2 dates

    post representative excel example file with source data and expected result

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

    Re: Count days per month per year between 2 dates

    Assume A1= start date, A2 = end date
    D2:F2 is year, month, days count all the way down
    D2:
    Please Login or Register  to view this content.
    E2:
    Please Login or Register  to view this content.
    F2:
    Please Login or Register  to view this content.
    Drag D2:F2 down as far as needed

    Attachment 816802
    Quang PT

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

    Cool Re: Count days per month per year between 2 dates

    something like this?

    From To Year Month Name Count Days
    15/12/2013
    18/02/2014
    2013
    December
    17
    2014
    January
    31
    2014
    February
    18

  5. #5
    Registered User
    Join Date
    02-07-2023
    Location
    United States
    MS-Off Ver
    0.8
    Posts
    23

    Re: Count days per month per year between 2 dates

    Quote Originally Posted by bebo021999 View Post
    Assume A1= start date, A2 = end date
    D2:F2 is year, month, days count all the way down
    D2:
    Please Login or Register  to view this content.
    E2:
    Please Login or Register  to view this content.
    F2:
    Please Login or Register  to view this content.
    Drag D2:F2 down as far as needed

    Attachment 816802
    thank you so much for your suggestion

  6. #6
    Registered User
    Join Date
    02-07-2023
    Location
    United States
    MS-Off Ver
    0.8
    Posts
    23

    Re: Count days per month per year between 2 dates

    Quote Originally Posted by sandy666 View Post
    something like this?

    From To Year Month Name Count Days
    15/12/2013
    18/02/2014
    2013
    December
    17
    2014
    January
    31
    2014
    February
    18
    alsothank you for your sugggestion

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

    Re: Count days per month per year between 2 dates

    Hi.

    Is your forum profile showing the Excel PRODUCT that you need this request to work with? I have no idea what 0.8 means!!

    The best solutions often rely on knowing WHICH Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date. If you aren't sure, in Excel go to File/Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent Excel PRODUCTS are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the Version number in your profile (e.g. MS365 (PC) Version 2211). The version number is in the About Excel section further down the Account page.

    Cheers,

    Glenn.
    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

  8. #8
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,418

    Re: Count days per month per year between 2 dates

    Power Query
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-07-2023
    Location
    United States
    MS-Off Ver
    0.8
    Posts
    23

    Re: Count days per month per year between 2 dates

    Quote Originally Posted by Glenn Kennedy View Post
    Hi.

    Is your forum profile showing the Excel PRODUCT that you need this request to work with? I have no idea what 0.8 means!!

    The best solutions often rely on knowing WHICH Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date. If you aren't sure, in Excel go to File/Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent Excel PRODUCTS are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the Version number in your profile (e.g. MS365 (PC) Version 2211). The version number is in the About Excel section further down the Account page.

    Cheers,

    Glenn.
    thank you so much for your suggestion

  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 2406
    Posts
    44,662

    Re: Count days per month per year between 2 dates

    Your Excel product still shows 0.8. Please update it.

+ 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 or month for each year from two dates
    By Cornelmd in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-09-2022, 02:16 AM
  2. Replies: 16
    Last Post: 08-22-2017, 11:20 AM
  3. [SOLVED] Calculate year month and days between two dates
    By Premmadaan in forum Excel General
    Replies: 7
    Last Post: 04-24-2017, 05:38 AM
  4. [SOLVED] How do return days,week no,month and year in between two dates
    By silambarasan.J in forum Excel General
    Replies: 5
    Last Post: 10-26-2016, 04:29 AM
  5. Replies: 15
    Last Post: 06-03-2014, 02:08 PM
  6. find time left in month.days unit between two dates(in YEAR.MONTH.DAY)
    By xcfeng95 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 02-21-2014, 12:55 PM
  7. Drop days from dates to just month and year
    By mrrpv in forum Excel General
    Replies: 2
    Last Post: 02-01-2007, 12:49 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