Reputation: 41
I have data that looks like this:
campaign_type
marmay2022
janmar2022
mayjul2022
I'm trying to sort it based on the year and the first 3 character according to the month and year.
Upvotes: 1
Views: 113
Reputation: 75960
Try:
Formula in C2
:
=INDEX(SORT({A2:A4,--("01/"&REPLACE(A2:A4,4,3,"/"))},2,1),0,1)
Upvotes: 2
Reputation: 37050
Give a try on below formula-
=QUERY({A1:A3,ArrayFormula(DATEVALUE("01-"&LEFT(A1:A3,3)&"-"&RIGHT(A1:A3,4)))},"select Col1 order by Col2")
Upvotes: 0