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).
Best 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
-
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.
-
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!
-
Happy to help. 👍️
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 434 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!