+ Reply to Thread
Results 1 to 5 of 5

Calculate days in date range

  1. #1
    Registered User
    Join Date
    09-18-2011
    Location
    SW FL
    MS-Off Ver
    Excel 2007
    Posts
    15

    Question Calculate days in date range

    I need to calculate the # of days in a service period within a date range and then prorate costs based upon those days. I've attached a sample worksheet and the date range I need to calculate on is 04/20/20 - 07/12/20. Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,826

    Re: Calculate days in date range

    I'm not sure if this is what you are looking for or not, but here's a formula I put in F2 and then copy down and across:
    =IFERROR(DAYS(IF($C2>EOMONTH(F$1,0),EOMONTH(F$1,0),IF($C2<F$1,"",$C2)),IF($B2<F$1,F$1,IF($B2>EOMONTH(F$1,0),"",$B2)))+1,0)

    In order for this to work (and be dynamic), I changed your headings to reflect the first day of the month (see attached). This can be handled many different ways, but for simplicity, I chose this.

    Also, in Cell J2 I entered this:
    =$E2/$D2*F2

    I then copied this down and across.

    Is this what you're looking for?
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    09-18-2011
    Location
    SW FL
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Calculate days in date range

    Hi Greg,

    I copied and pasted the formula to calculate the days in F2 and it didn't work. I got the result '0'. Your tip to calculate J2, however, did work. Any further help on how to calculate F2?

  4. #4
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,826

    Re: Calculate days in date range

    I don't know how J2 could work if F2 didn't. I can't tell what the problem is if you don't attach your file. Did you open mine and did it show the right results?

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

    Re: Calculate days in date range

    in F2
    Please Login or Register  to view this content.
    Quang PT

+ 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] Calculate # days in week based on date range
    By Peelah in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-28-2016, 07:01 PM
  2. Replies: 3
    Last Post: 10-15-2015, 01:06 PM
  3. Replies: 0
    Last Post: 07-17-2014, 06:31 AM
  4. Replies: 4
    Last Post: 01-17-2013, 01:23 PM
  5. Calculate the number of weekend days between a date range
    By nebtnarg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-10-2012, 07:00 AM
  6. [SOLVED] Calculate how many days in one date range fall into a second date range
    By globalpontoon in forum Excel General
    Replies: 2
    Last Post: 05-08-2012, 03:02 PM
  7. trying to calculate regular days in date range excluding holidays
    By DKY in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-14-2008, 09:12 PM

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