Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function to build timebuckets

Status
Not open for further replies.

emailswe

Technical User
Aug 20, 2007
9
SE
Hi

I would like to get som help with a function that I wrote, I would like the function to give me timebuckets from a string. This is were I am @ the moment:

Function Test(Period As Double) As Double

Dim M As String
Dim Y As String

M = Right(Period, 2)
Y = Left(Period, 4)

If M = "05" Then
Test = "Q1"
Else


End If


End Function

The "Period" could look like '2008 05'

Could any helpful soul out there help me plz
//Emil
 
And the problem is ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You seem to be working with strings ... not doubles.
Code:
Function Test(Period As [red]String[/red]) As [red]String[/red]
 
From your example, it looks like you are trying to put the months into quarters according to a fiscal calendar.

I'm quite sure you not even need to go VBA for that, but if you want to I strongly suggest to convert the strings to actual dates.


If you post what your input looks like and what exactly it is that you're trying to achieve, you'll enable us to help you better.

Cheers,

Roel

 



I'd srongly suggest using REAL DATES for time buckets. You can FORMAT to appear as you want, but STRINGS are almost useless.

REAL DATES can be grouped many different ways.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top