+ Reply to Thread
Results 1 to 5 of 5

Calculating Days in a month depending on start date and end date of order

  1. #1
    Registered User
    Join Date
    09-06-2018
    Location
    Raleigh, NC
    MS-Off Ver
    MS365 V2202
    Posts
    24

    Calculating Days in a month depending on start date and end date of order

    I'm trying to create a formula that tells me how many days I have in a certain month based on the start date and end date of an order. There are 9 situations that I'm trying to create a formula for:
    Days in a campaign= if the order started before December 1, but ended 12/31 THEN 12/31-12/1
    Days in a campaign= if the order started before December 1, but ended before 12/31 THEN END DATE-12/1
    Days in a campaign= if the order started before December 1, but ends after 12/31 THEN 12/31-12/1
    Days in a campaign= if the order started December 1, but ended before 12/31 THEN END DATE-12/1
    Days in a campaign= if the order started December 1, but ended after 12/31 THEN 12/31-12/1
    Days in a campaign= if the order started December 1, but ended on 12/31 THEN 12/31-12/1
    Days in a campaign= if the order started after December 1, but ended before 12/31 THEN END DATE-START DATE
    Days in a campaign= if the order started after December 1, but ended after 12/31 THEN 12/31- START DATE
    Days in a campaign= if the order started after December 1, but ended on 12/31 THEN 12/31-START DATE

    I only care about what's in December (or whatever month it is).

    I thought it would be an IF statement, but I can't figure out how to write it out in excel.

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

    Re: Calculating Days in a month depending on start date and end date of order

    Please upload a sample Excel workbook with 10-20 rows of relevant data ... Start / End dates ... other wise you are asking volunteers to supply fake data which may not be representative. It saves time.

    If you are not familiar with how to do this:

    To attach a file to your post: (Please no pics or screenshots ... saves retyping data.),

    be sure to desensitize the data
    • click “Go Advanced” (next to Post Quick Reply – bottom right),
    • scroll down until you see “Manage Attachments”, click that,
    • click “Browse”.
    • select your file(s)
    • click “Upload”
    • click “Close window”
    • click “Submit Reply”
    The file name will appear at the bottom of your reply.
    Dave

  3. #3
    Registered User
    Join Date
    09-06-2018
    Location
    Raleigh, NC
    MS-Off Ver
    MS365 V2202
    Posts
    24

    Re: Calculating Days in a month depending on start date and end date of order

    That's a good point. Workbook attached with examples of all situations there. I need 1 formula to be able to calculate the dates for all of those situations, depending on the dates provided in the report.
    Attached Files Attached Files

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

    Re: Calculating Days in a month depending on start date and end date of order

    Only December ... the attached assumes only December 2018. Note the 0 in JNLSPAID_P1100_PCH_GSK_01SEP18_LL_Canada 12/1/2019 1/16/2019


    With the first of the target month in cell E1 (change date to change month) this formula in D2 and filled down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 01-28-2019 at 10:11 PM.

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,914

    Re: Calculating Days in a month depending on start date and end date of order

    Or try:

    =SUMPRODUCT(--(MONTH(ROW(INDIRECT(B2&":"&C2)))=12))

+ 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. Replies: 3
    Last Post: 12-09-2014, 09:29 PM
  2. Replies: 2
    Last Post: 03-22-2013, 02:20 PM
  3. [SOLVED] Calculating recurring date in following month, calculating # days in that period
    By Walterius in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 02:05 AM
  4. Replies: 6
    Last Post: 09-06-2005, 01:05 AM
  5. Replies: 6
    Last Post: 09-06-2005, 12:05 AM
  6. [SOLVED] Calculating recurring date in following month, calculating # days in that period
    By Walterius in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-05-2005, 11:05 PM
  7. [SOLVED] Calculating recurring date in following month, calculating # days in that period
    By Walterius in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-04-2005, 07:05 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