sorry my mistake..i actually meant 25/12/2019 or 25/12/19
There is a simpler UDF available (the Format function has an meta-character for quarter)...Here's a UDF.
Code:Function QUARTER(dt As Date) As String QUARTER = "Qtr" & WorksheetFunction.Floor((Month(dt) - 1) / 3, 1) + 1 & " " & Format(dt, "YY") End Function
Function QUARTER(D As Date) As String
QUARTER = "Qtr" & Format(D, "q yy")
End Function
Using XL2010, when I click within the keyword Format within the VBA editor and press the F1 key, the help file for the Format function comes up... when I scroll down to the section titled "User-Defined Date/Time Formats (Format Function)", the "q" meta-character is listed about two-thirds of the way down.Lol. I looked up the documentation on the format function and ‘q’ was not in there. Microsoft lied to me!
Function QUARTER(d As Date) As String
QUARTER = Format(d, "\Qtrq yy")
End Function
I thought about doing it that way, but wasn't sure if the "t" or "r" might have meaning in some other locales (I have had this problem with date and time formats, so I am never sure if non-date formats also have this problem). Of course we could simply escape them as well I guess, just to be sure...I see it now. Cool. Digging around in the docs i saw that you can use escape characters, didn't know that, so here's another way.
Code:Function QUARTER(d As Date) As String QUARTER = Format(d, "\Qtrq yy") End Function
Function QUARTER(d As Date) As String
QUARTER = Format(d, "\Q\t\rq yy")
End Function