Quarter_to_Words

Convert Quarter code to text per special project requirements.
A special function to serve simple task by converting ...
1Q2019        >>>        1st Quarter 2019
2Q2019        >>>        2nd Quarter 2019
3Q2020        >>>        3rd Quarter 2020
4Q2018        >>>        4th Quarter 2018

May be enhanced to also do ...
1Q2019        >>>        Full year 2018
2Q2019        >>>        1st Half 2019
3Q2020        >>>        First 9 months 2020
4Q2018        >>>        Full year 2018

CodeFunctionName
What is this?

Public

Tested

Original Work
Function Quarter_to_Words(SellQ)
    ' Change the quarter to words using VBA
    ' 1Q2019        > > >        1st Quarter 2019
    ' 2Q2019        > > >        2nd Quarter 2019
    ' 3Q2020        > > >        3rd Quarter 2020
    ' 4Q2018        > > >        4th Quarter 2018
    ' KV = =IF(OR($B2=""),"",CHOOSE(LEFT($D2,1),"1st","2nd","3rd","4th")&" Quarter "&MID($D2,3,4))
    ' KW = =IF(OR($B2=""),"",CHOOSE(LEFT($D2,1),"Full Year "&VALUE(MID($D2,3,4))-1,"1st Half "&MID($D2,3,4),"First Nine Months "&MID($D2,3,4),"Full Year "&MID($D2,3,4)))
    '
    Select Case Val(Left(SellQ, 1))
    Case 1: Q01 = "1st"
    Case 2: Q01 = "2nd"
    Case 3: Q01 = "3rd"
    Case 4: Q01 = "4th"
    End Select
    Quarter_to_Words = Q01 & " Quarter " & Mid(SellQ, 3, 4)
End Function

SellQ

? Quarter_to_Words("2Q2017")

Views 649

Downloads 231

CodeID
DB ID