0

I have a custom column at present which works great:

MonthOrder = SWITCH([DateText],"Apr-2024", 1, "May-2024", 2, "Jun-2024", 3, "Jul-2024", 4,"Aug-2024",5,"Sep-2024",6,"Oct-2024",7,"Nov-2024",8,"Dec-2024",9,"Jan-2025",10,"Feb-2025",11,"Mar-2025",12)

However, for the new year I need to make the dates into a wildcard, ie LIKE "Apr%", "May%" etc but I am not sure if this can be done. Has anyone done this before?

1 Answer 1

0

You could use the LEFT function to get the first three characters, and then switch on that:

MonthOrder = SWITCH( LEFT([DateText], 3), "Apr", 1, "May", 2, ..., "Mar", 12)

Alternatively, you could leverage the DATEVALUE function to convert the date text to a Date, then offset the months, then use the MONTH function:

MonthOrder = MONTH( EOMONTH(DATEVALUE("01-" & [DateText]), -3) )
Sign up to request clarification or add additional context in comments.

1 Comment

That looks like it could work - thank you so much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.