Why is my Friday considered as next week?

Hello Smartsheet Community,

I'm currently setting up few formulas for Admin Dashboard. So I would a certain date period be counted as This Week or Next Week.

This Week:

=IF(WEEKDAY([Start Date]@row) = 1, IF(AND(YEAR(TODAY()) = YEAR([Start Date]@row), WEEKNUMBER(TODAY()) = WEEKNUMBER([Start Date]@row + 1)), "Current Week"), IF(WEEKDAY([End Date]@row) > 1, IF(AND(YEAR(TODAY()) = YEAR([End Date]@row), WEEKNUMBER(TODAY()) = WEEKNUMBER([End Date]@row)), "Current Week")))

Next Week:

=IF(WEEKDAY([Start Date]@row) = 1, IF(AND(YEAR(TODAY()) = YEAR([Start Date]@row), WEEKNUMBER(TODAY()) = WEEKNUMBER([Start Date]@row)), "Next Week"), IF(WEEKDAY([End Date]@row) > 1, IF(AND(YEAR(TODAY()) = YEAR([End Date]@row), WEEKNUMBER(TODAY()) + 1 = WEEKNUMBER([End Date]@row)), "Next Week")))

My Today() is 23/5/2024

Everything works well, but when I tried 24/5/2024 - 28/05/2024, it considered that as Next Week instead.

Answers

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    It is because of how you have your formula written. Since the weekday of [Start Date] is not 1, it moves on to evaluating the [End Date] weekday. The [End Date] weekday is greater than 1 and the year matches, but the week number is not the same as today's week number.

    In your next week formula, the same is true in that it is evaluating the [ENd DAte]. Since that week number is today's week number plus 1, it is outputting "Next Week".

    Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!

    CERTIFIED SMARTSHEET PLATINUM PARTNER

    10xViz.com

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!