# Thread: Quarters

1. Registered User
Join Date
Feb 2004
Location
UK
Posts
246

## Unanswered: Quarters

Hi,
I know I've seen the answer to this on the forum, but for some reason the search tools do not work....................so I'll have to post this query.

How can I work out the quarter in which a date falls, ie Jan 1 to Mar 31 is quarter 1, Apr 1 to Jun 30 is quarter 2 etc.

I'm sure I've seen a quick quarter function, as I realise its relatively easy to work out with IF statements, but I wanted to make it a little more slick.

Regards
John

2. Grand Poobah
Join Date
Sep 2003
Location
MI
Posts
3,713
Originally Posted by Sticker
Hi,
I know I've seen the answer to this on the forum, but for some reason the search tools do not work....................so I'll have to post this query.

How can I work out the quarter in which a date falls, ie Jan 1 to Mar 31 is quarter 1, Apr 1 to Jun 30 is quarter 2 etc.

I'm sure I've seen a quick quarter function, as I realise its relatively easy to work out with IF statements, but I wanted to make it a little more slick.

Regards
John
Code fragment:

BillMonth = DatePart("m", MyRecSet.Fields(5).Value)
' Labor Amount
If MyRecSet.Fields(2).Value <> 0 Then
TrgRecSet.Fields(BillMonth + 1).Value = MyRecSet.Fields(2).Value
If BillMonth < 4 Then TrgRecSet.Fields(14).Value = MyRecSet.Fields(2).Value
If BillMonth < 7 Then TrgRecSet.Fields(15).Value = MyRecSet.Fields(2).Value
If BillMonth < 10 Then TrgRecSet.Fields(16).Value = MyRecSet.Fields(2).Value
TrgRecSet.Fields(17).Value = MyRecSet.Fields(2).Value
End If

3. Registered User
Join Date
Feb 2004
Location
UK
Posts
246
Thanks for that Mike, you've caused me to recall the function for calculating quarters,

DatePart("q",[Period])

Regards
John

4. Grand Poobah
Join Date
Sep 2003
Location
MI
Posts
3,713
Yep... I have to post mine by month AND have a quarterly summary and yearly total ... That's why mine is done the way it is ...

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•