+ Reply to Thread
Results 1 to 10 of 10

How to return number of quarters from start date, then return zero after end date passed

  1. #1
    Registered User
    Join Date
    11-08-2017
    Location
    Seattle
    MS-Off Ver
    2010
    Posts
    26

    How to return number of quarters from start date, then return zero after end date passed

    Trying to create a formula in cells E3 to G3 that will return the number of quarters between the dates in B3 and C3. For instance, in cell E3, would like for the formula to return "1" as there is one quarter between 1/1/2023 and 3/31/2023. The formula would return "2" in cell F3 as there are two quarters between 1/1/2023 and 7/1/2023. Finally, the formula would return zero in cell G3 as 9/30/2023 is past the end date of 7/1/2023.

    I am also trying to do the same thing above but when the cells are in a quarterly date format (i.e. "1Q23"). Not sure if it is possible to do this with this format.

    Thank you.Timing Model.PNG
    Last edited by StanLeakup; 02-24-2023 at 12:20 AM.

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

    Re: How to return number of quarters from start date, then return zero after end date pass

    It's always best to attach a sample workbook, that way people here don't have to recreate/type in your data. Please read the yellow banner at the top of the page.

    Also, are we to assume that a quarter starts on Jan 1, then Apr 1, etc.?
    If you have a start date of 2/1/23 and in cell E2 you have 4/30/23, is that 1 qtr (3 months) or 0 because it doesn't hold Q1 or Q2 fully?
    I would have expected G3 to be 2, but you say you want it to be 0. If cell F2 were 7/1/23, should F3 then say 0 since F2 is passed the End date.

  3. #3
    Registered User
    Join Date
    11-08-2017
    Location
    Seattle
    MS-Off Ver
    2010
    Posts
    26

    Re: How to return number of quarters from start date, then return zero after end date pass

    Excel model date question.xlsx

    Apologies, see attached Excel spreadsheet.

    For simplicity, if we could assume that all quarters start on the first day of each quarter (i.e. 1/1/23, 4/1/23, 7/1/23, 10/1/23).
    You are correct that if cell F2 were 7/1/23, I would like for F3 to show 0 since F2 is passed the End date. Thanks Greg.
    Last edited by StanLeakup; 02-24-2023 at 12:18 AM.

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

    Re: How to return number of quarters from start date, then return zero after end date pass

    Are the Start and End dates (values in B3 and C3) ALWAYS the start and end of a quarter, or could the Start date (in B3), be 2/1 for example?

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

    Re: How to return number of quarters from start date, then return zero after end date pass

    Also, same question for dates in cells E3, F3, G3 - will these ALWAYS be the end dates of quarters, or might they be random dates (like 3/22/23)?

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

    Re: How to return number of quarters from start date, then return zero after end date pass

    You can try this, but it could be wrong depending on your answers above:

    in cell E3 and copy across:
    =ROUNDDOWN(IF(E2>$C3,0,DATEDIF($B$3,E2+1,"M"))/3,0)
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-08-2017
    Location
    Seattle
    MS-Off Ver
    2010
    Posts
    26

    Re: How to return number of quarters from start date, then return zero after end date pass

    I misspoke earlier and edited the spreadsheet. The start date in B3 will be the first day of each quarter i.e. 1/1/2023. End date in C3 will always be first day after the end of a quarter i.e. 7/1/23 or 10/1/23. Have now edited cell C3 in the post.

    Cells E3, F3 and G3 will always be last day of quarter (only 3/31, 6/30, 9/30 and 12/31).

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

    Re: How to return number of quarters from start date, then return zero after end date pass

    The my answer stands. Use formula in post #6 - it should work.

  9. #9
    Registered User
    Join Date
    11-08-2017
    Location
    Seattle
    MS-Off Ver
    2010
    Posts
    26

    Re: How to return number of quarters from start date, then return zero after end date pass

    Thanks Greg. How does this formula change if the End Date then becomes 4/1/2024? See attached. Thanks!

    Excel model date question v2.xlsx

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

    Re: How to return number of quarters from start date, then return zero after end date pass

    Sorry, I didnt know you were going to list dates down the rows. so I just needed to add the $ signs in the right place. Try this in E3, and copy across and down:

    =ROUNDDOWN(IF(E$2>$C3,0,DATEDIF($B3,E$2+1,"M"))/3,0)

+ 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. How to add a number of quarters to a start date that is shown as 1Q23?
    By StanLeakup in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-23-2023, 02:37 PM
  2. [SOLVED] Max number of consecutive days based on criteria in 2nd column and return start date
    By T86157 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-22-2023, 10:49 PM
  3. [SOLVED] Nested IF formula to return value based on date but stop after 12 quarters
    By Jess0121 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-06-2022, 03:40 PM
  4. Replies: 2
    Last Post: 04-01-2020, 03:10 AM
  5. Replies: 2
    Last Post: 04-26-2017, 08:06 AM
  6. [SOLVED] Return value of 1 when the start date still running up to the end date or cancelled date
    By dylanrose in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-24-2016, 11:28 AM
  7. [SOLVED] How to return the most recently passed date from array
    By ineedthisspread in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-21-2013, 08:45 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