Query for Quarter Months

LEXCERM

Active Member
Joined
Jun 26, 2004
Messages
320
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm trying to write a query to return a list of quarterly dates starting from any given START DATE. For example, here is the original
incremented list:-

20/8/2015 START DATE
21/8/2105
22/8/2015
23/8/2015
...and so on ...
20/11/2015
21/11/2015
22/11/2015 ... and the list of dates go on.

The result should look like this:-
20/8/2015 (START DATE)
20/11/2015
20/2/2016 ... etc

So the end result will be a list of dates every three months. I've tried DATEPART, DATEADD, GROUPING etc but to no avail.

Thanks in advance. :)
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I've tried some query stuff but think you will be stuck with code. However, I can only see how to add a number of days (say 94) to get the subsequent dates after a start date because the dates you are looking for have no relevance to the quarter part of a year. That means the datepart function datepart("q",startdate) won't work. If you were to append the values to a table, for instance, then I'm thinking you'd loop through a recordset of dates, add the start date to the table first, and if the next date satisfies the expression if nextdate=begindate+94 then... and write that value. You then move to the next record and test again. Each time the expression is true, you'd have to update the value of begindate to test the incremented date against itself plus 94 days.
However, I don't know your data set, so I have no idea what happens if begindate values are greater than begindate+94, but are in fact say, 105 days greater. The next comparison may based on a date that was 105 days greater than the first, then 94 greater than that, which may not be the same result that you'd get if you compared the first date against that + 94, then against that +188. Hope you're following this.

You might want to copy your dates to Excel and use a formula to display them if they're > 3 months as an alternative, or maybe just a comparison to whatever method you end up with.
 
Upvote 0

Forum statistics

Threads
1,221,847
Messages
6,162,380
Members
451,760
Latest member
samue Thon Ajaladin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top