LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Financial Quarter from dd/mm/yyyy

Hi All,

I regularly need to derive a financial quarter from a date (dd/mm/yyyy) so I
decided to create a function to do it for me but I'm really struggling! The
problem is that the year runs from April to March NOT Jan to Dec.

I have a column of dates and I want the function to return the quarter and
year something like
Date is 25/04/2005
Result should be Q1 05/06 (ie the first quarter in the financial year which
spans 2005 and 2006)

I have got the Q bit sorted but the yy/yy bit just wont play ball.

For what its worth, heres what I have done (which doesn't work!!!)

Public Function FinancialQuarter (Mydate)
Dim lngQ As Long
Dim lngY As Long

If Month(MyDate) / 3 <= 1 Then
lngQ = 4
Else
lngQ = Month(MyDate) / 3 - 1
End If
If lngQ = 4 Then
lngY = Mid(Year(MyDate), 3, 2) - 1 & "/" & Mid(Year(MyDate), 3, 2)
Else
lngY = Mid(Year(MyDate), 3, 2) & "/" & Mid(Year(MyDate), 3, 2) + 1
End If
FinancialQuarter = "Q" & lngQ & " " & lngY
End Function


I'm sure there is a simple way to do this but I am only fairly new to this.

Any help greatly appreciated.

Paul
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula bar shows mm/dd/yyyy. To show dd/mm/yyyy. How? magna Excel Discussion (Misc queries) 2 January 1st 08 08:14 AM
How do I convert a birthdate format from yyyy/mm/dd to mm/dd/yyyy Amy Ann Excel Worksheet Functions 3 December 13th 07 08:07 PM
how do I change date from mm/dd/yyyy to dd:mm:yyyy format in Excel Jack Wilson New Users to Excel 4 July 18th 06 01:57 PM
change birthday display from mm/dd/yyyy to HIDE the yyyy? johnp Excel Worksheet Functions 1 May 9th 06 09:56 PM
opening excel file - date format problem: DD/MM/YYYY vs MM/DD/YYYY yung Excel Programming 2 March 18th 05 12:50 PM


All times are GMT +1. The time now is 10:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"