Extracting Month from Date

I would like to filter records based on a date in the past whose month falls within the next two months. For example, if today is 1/26/23, all records that fall between today and March 26 (i.e. 2/1/2019 would filter through). I can't figure out how to ignore the year (which will always be in the past).

Tags:

Best Answer

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    Try something like this...


    =IF(AND(MONTH([DAte Column]@row)>= MONTH(TODAY()), MONTH([Date Column]@row)<= IF(MONTH(TODAY())>= 11, MONTH(TODAY()) - 10, MONTH(TODAY()) + 2)), 1)


    This will put a 1 (or check a box/ mark a flag) in any row that has a month either this month or two months in the future regardless of the year.

Answers

  • David Tutwiler
    David Tutwiler Overachievers Alumni

    Have you tried using the MONTH function? It pulls the month out of a date field.

    =MONTH(date@row) --> This would return the number 1 for today's date and the number 1 for a date in January of 2022.

  • Thank you, David. Yes, I have a column with the number associated with the month's date and also a column with "today"'s date in it. I can't figure out how to get those two numbers to interact in a third column and/or using a filter in my report.

    My ultimate goal: All employees have training hours due on their anniversary, and I'd like to pull a report that has all employees who have an anniversary month within the next two months.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    Try something like this...


    =IF(AND(MONTH([DAte Column]@row)>= MONTH(TODAY()), MONTH([Date Column]@row)<= IF(MONTH(TODAY())>= 11, MONTH(TODAY()) - 10, MONTH(TODAY()) + 2)), 1)


    This will put a 1 (or check a box/ mark a flag) in any row that has a month either this month or two months in the future regardless of the year.

  • That's exactly what I needed. Thank you so very much!

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Happy to help. 👍️

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!