How to tell which fiscal qtr a user defined date falls in, excel

J

jwmott

I need to determine whihc fiscal quarter a date falls in. The begin and end
dates fo the fiscal year are user defined.
 
J

Jim Cone

Function WhichQuarter(ByRef dteToAllocate As Date) As String
'Jim Cone - San Francisco USA - October 2005
Const Q1End As Date = #3/31/2005#
Const Q2End As Date = #6/30/2005#
Const Q3End As Date = #9/30/2005#
Const Q4End As Date = #12/31/2005#

Select Case True
Case dteToAllocate <= Q1End
WhichQuarter = "Date occurs in First Quarter "
Case dteToAllocate <= Q2End
WhichQuarter = "Date occurs in Second Quarter "
Case dteToAllocate <= Q3End
WhichQuarter = "Date occurs in Third Quarter "
Case dteToAllocate <= Q4End
WhichQuarter = "Date occurs in Fourth Quarter "
End Select
End Function

'Call function
Sub FindQuarter()
MsgBox WhichQuarter("07/30/2005")
End Sub


"jwmott" <[email protected]>
wrote in message
I need to determine whihc fiscal quarter a date falls in. The begin and end
dates fo the fiscal year are user defined.
 
J

Jim Cone

Another approach...
'-------------
Sub GetTheQuarter()
Dim strQ As String
strQ = Format$("07/30/2005", "q", 0, 0)
MsgBox strQ
End Sub
'-------------
Jim Cone
San Francisco, USA



"jwmott" <[email protected]>
wrote in message
I need to determine whihc fiscal quarter a date falls in. The begin and end
dates fo the fiscal year are user defined.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top