Hi All ,
I have below code to group number of days into the buckets. If the number of days is between 11-30 then it should return 1 month, if it's between 31-90 then 3 months etc..
I couldn't work it out which goes to D2m and which goes to D2Ms
Would you mind to have a look at the udf and give me an example please?
Thanks very much
HTML Code:
Function Bucket(d2m As Integer, D2Ms As Variant) As Variant
Dim Fnd_bckt As Boolean
Dim d2m_cnt As Integer
Fnd_bckt = False
d2m_cnt = 1
While Not Fnd_bckt And d2m_cnt <= 6
Fnd_bckt = (d2m > D2Ms(d2m_cnt, 1)) And (d2m <= D2Ms(d2m_cnt, 2))
d2m_cnt = d2m_cnt + 1
Wend
If Fnd_bckt Then
Bucket = D2Ms(d2m_cnt - 1, 3)
End If
End Function