+ Reply to Thread
Results 1 to 5 of 5

# days in a certain month between any two dates

  1. #1
    Forum Contributor
    Join Date
    07-29-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2010
    Posts
    186

    # days in a certain month between any two dates

    Hi there,

    If I have the start date of 29/7/2013 and end date of 3/8/2013 and need the output to be July = 2 and August = 3, is there a formula that will achieve this?

    Sheet attached. Output cells are in orange under the month number

    Kind regards,

    MQ
    Attached Files Attached Files
    Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind.

  2. #2
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: # days in a certain month between any two dates

    for the first part (july) Eomonth(startdate)-startdate gives days left in the month of july,(2) and day(enddate) will give your 3, although day(enddate)-1 is really the actual days between,then we have the issue of if the months are not consecutive...is there a limit on the size of the spread between the 2 dates?
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,130

    Re: # days in a certain month between any two dates

    hi MQ. why is C2 2? 29 Jul, 30 Jul, 31 Jul. 3 days? if you want to exclude the start date, then C3 should be 12? to get 3 days, you can try in C2:
    =SUMPRODUCT(--(MONTH(ROW(INDIRECT($A2&":"&$B2)))=C$1))

    don't understand how you got 12 for C6, 5 for N4, 4 for L7. maybe you can explain those. to hide the zeroes, you can format the cells as:
    General;;

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Forum Contributor
    Join Date
    07-29-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2010
    Posts
    186

    Re: # days in a certain month between any two dates

    Quote Originally Posted by dredwolf View Post
    for the first part (july) Eomonth(startdate)-startdate gives days left in the month of july,(2) and day(enddate) will give your 3, although day(enddate)-1 is really the actual days between,then we have the issue of if the months are not consecutive...is there a limit on the size of the spread between the 2 dates?
    No limit between the dates, could span over many months as they are employee leave start and end dates. Not likely an employee would be be away for an entire year unless its a special circumstance.

  5. #5
    Forum Contributor
    Join Date
    07-29-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2010
    Posts
    186

    Re: # days in a certain month between any two dates

    Quote Originally Posted by benishiryo View Post
    hi MQ. why is C2 2? 29 Jul, 30 Jul, 31 Jul. 3 days?
    Yep, sorry about that, put that sheet together a little too quick..

+ 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 days per month between two dates
    By ryets in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-24-2013, 03:16 PM
  2. [SOLVED] Days in particular month between two dates
    By Branno in forum Excel General
    Replies: 3
    Last Post: 06-25-2012, 06:17 PM
  3. Column of days and dates for a given month
    By johnfar in forum Excel General
    Replies: 6
    Last Post: 11-23-2011, 12:22 AM
  4. Calculating Month and days betweens dates
    By deepak_gl in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-30-2007, 08:34 AM
  5. Dates - Several Days In a month to month only
    By Andy_Pimp in forum Excel General
    Replies: 1
    Last Post: 02-28-2006, 07:15 AM

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