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: 193
Default Fiscal Quarter code not working

This code works when x = a date, but if the cell is blank it displays a "2"
not the error message Case Else should display. Any ideas why?

Function GetFiscalQuarter(ByVal x As Date) 'this works as variant also
Dim Qtr As Date 'this works as integer or variant
Qtr = DatePart("m", x)

Select Case Qtr
Case 7, 8, 9
Qtr = "1"
Case 10, 11, 12
Qtr = "2"
Case 1, 2, 3
Qtr = "3"
Case 4, 5, 6
Qtr = "4"
Case Else
Qtr = "error" 'this doesn't work at all!!!!
End Select

GetFiscalQuarter = Qtr

End Function

--
Robert
 
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
How do I convert a specific date to a fiscal quarter ? RichNYC Excel Discussion (Misc queries) 10 November 26th 07 03:35 PM
Fiscal Quarter Conversion Andrew Excel Worksheet Functions 7 April 3rd 07 08:26 PM
fiscal quarter conversion Ted McCastlain Excel Discussion (Misc queries) 3 September 6th 06 10:25 PM
fiscal quarter data validation Doug Glancy Excel Worksheet Functions 2 August 12th 05 12:12 AM
display quarter and fiscal year D S K Excel Programming 1 May 7th 04 03:44 PM


All times are GMT +1. The time now is 05:05 AM.

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

About Us

"It's about Microsoft Excel"