Formulas for the first and last day of the quarter?

Solved
Tessel75 -  
lahkar7 Posted messages 31 Status Membre -
Hello,
I have several formulas to automatically calculate the first and last days of the month, year, and week based on any given date, and I would like to do the same for the first and last days of the quarter.
(This helps me when I need to select records between two dates and I want my selection to refer to whole periods)
For example
FirstDayOfMonth = DateAdd("d", -Day(d) + 1, d)
LastDayOfMonth = DateAdd("m", 1, d) - Day(d)

with d = any given date
Thank you for your ideas and suggestions

Configuration: Windows 7 / Firefox 30.0

4 réponses

Mike-31 Posted messages 18405 Registration date   Status Contributeur Last intervention   5 146
 
Hello,

if I understood correctly, starting from a date in A1

First day of a quarter: =DATE(YEAR(A1);INT((MONTH(A1)-1)/3)*3+1;1)

Last day of the quarter: =DATE(YEAR(A1);INT((MONTH(A1)-1)/3)*3+4;0)

--
Cheers,
Mike-31

A period of failure is a perfect moment to sow the seeds of knowledge.
1
f894009 Posted messages 17417 Registration date   Status Membre Last intervention   1 717
 
Hello,

in principle, the quarters are well defined, so I don't quite understand the request !!!!!
0
Tessel75
 
Thank you Mike, your formula works well. I'm studying how it works.

At F89__, the question is that I need a floating date, for example starting from today's date. I agree to accept that there is only one first day of the year per year, and 4 first days of the quarter; the problem is that when it comes to automatically setting the boundaries of a period in the middle of a procedure, or in a dialog box, and when working with thousands or tens of thousands of records, then determining this via a formula is essential (or at least I feel that way).
Thanks again.
0
lahkar7 Posted messages 31 Status Membre
 
Thank you so much Mr. Mike-31
Your response is very clear and very accurate
0