I am trying to use a different row filter depending on a condition. I want to filter the rows based on a column that has a date, and I want to get the rows that happen the next month. My idea is that I check if the row's month is equal to the next month and do the same check for the year. However, there would be an issue if TODAY's date is in december and next month will be in another year. I can't figure out how to check for current year if we are in another month, but if we are in December, to check for the next year. This is what I have at the moment which is not working as intended for the year portion.
```
IF(MONTH(TODAY()) = 12,
YEAR(TODAY()) = YEAR([Fecha estimada de cierre]),
YEAR(TODAY())+1 = YEAR([Fecha estimada de cierre]))
```
Solved! Go to Solution.
In general you could try TEXT() functions so that the year of the date is also included with relative ease.
So you could try a filter condition as follows to get the records where [Fecha estimada de cierre] is in the next month.
TEXT([Fecha estimada de cierre], "YYMM") = TEXT( EOMONTH(TODAY(), 0)+1, "YYMM")
In the above expression, the subexpression TEXT( EOMONTH(TODAY(), 0)+1, "YYMM") will produce a month and year of the next month irrespective of the month and year of the current month. This is so because EOMONTH(TODAY(), 0)+1 will give the first day of the next month.
In general you could try TEXT() functions so that the year of the date is also included with relative ease.
So you could try a filter condition as follows to get the records where [Fecha estimada de cierre] is in the next month.
TEXT([Fecha estimada de cierre], "YYMM") = TEXT( EOMONTH(TODAY(), 0)+1, "YYMM")
In the above expression, the subexpression TEXT( EOMONTH(TODAY(), 0)+1, "YYMM") will produce a month and year of the next month irrespective of the month and year of the current month. This is so because EOMONTH(TODAY(), 0)+1 will give the first day of the next month.
User | Count |
---|---|
20 | |
16 | |
4 | |
3 | |
2 |