Month Function Sorting in Report

Hello!

I have a sheet that captures items and their start/end dates in a date format. I am trying to create a report that will group the items by the Month that the item is taking place in chronological order (Ex: All items with the target end date in January would be grouped under "January", followed by all items with the target end date in February grouped under "February", etc.).

Unfortunately I realized that the Month function will only return the number value of the month, rather than the word. To get around that, I created a nestled if function (outlined below), which is working to display the Month value, but now in my report I am struggling to get it to sort to show the Months in the correct order (ie. January, Feb, March, etc.). I even went as far as adding month numbers into my function so that the months will display as "1 - January", with the hopes that I would be able to sort the groups ascending to show in the correct order in the report, but it's still not working correctly. Does anyone have any tips?? I feel like this shouldn't be so complicated. Thanks in advance!!


Formula: =IF(MONTH([Target End Date]@row) = 1, "1 - January", IF(MONTH([Target End Date]@row) = 2, "2 - February", IF(MONTH([Target End Date]@row) = 3, "3 - March", IF(MONTH([Target End Date]@row) = 4, "4 - April", IF(MONTH([Target End Date]@row) = 5, "5 - May", IF(MONTH([Target End Date]@row) = 6, "6 - June", IF(MONTH([Target End Date]@row) = 7, "7 - July", IF(MONTH([Target End Date]@row) = 8, "8 - August", IF(MONTH([Target End Date]@row) = 9, "9 - September", IF(MONTH([Target End Date]@row) = 10, "10 - October", IF(MONTH([Target End Date]@row) = 11, "11 - November", IF(MONTH([Target End Date]@row) = 12, "12 - December"))))))))))))


Best Answer

  • NancyRiccardi
    NancyRiccardi ✭✭
    Answer ✓

    Thanks @Andrée Starå. I actually found another method to hopefully make it a little easier for my stakeholders to view the information.

    I added another column into my source sheet for "Year". In that column I entered the following formula:

    =YEAR([Target End Date]@row)

    I went back to my original Month formula below:

    =IF(MONTH([Target End Date]@row) = 1, "01 - January", IF(MONTH([Target End Date]@row) = 2, "2 - February", IF(MONTH([Target End Date]@row) = 3, "03 - March", IF(MONTH([Target End Date]@row) = 4, "04 - April", IF(MONTH([Target End Date]@row) = 5, "05 - May", IF(MONTH([Target End Date]@row) = 6, "06 - June", IF(MONTH([Target End Date]@row) = 7, "07 - July", IF(MONTH([Target End Date]@row) = 8, "08 - August", IF(MONTH([Target End Date]@row) = 9, "09 - September", IF(MONTH([Target End Date]@row) = 10, "10 - October", IF(MONTH([Target End Date]@row) = 11, "11 - November", IF(MONTH([Target End Date]@row) = 12, "12 - December"))))))))))))

    Then in my report I grouped by Year first and then Month, which makes it a bit easier to view.

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!