jase71ds
Board Regular
- Joined
- Oct 23, 2006
- Messages
- 137
- Office Version
- 365
- Platform
- Windows
I've spent way too much time trying to figure this formula out. I need help.
I have a named range "rng_ReportPeriod" that I manually assign a value to on a monthly basis, and it is ALWAYS the last day of the current month.
Thus, currently rng_ReportPeriod is 3-31-18
Elsewhere in my spreadsheet, I need to increment the months by 1, 2, 3 ... 11
So for the area of the spreadsheet where I need to increment by 1, when rng_ReportPeriod is 3-31-18 (as is currently) I need the resulting 1 month increase to return 4-30-18
I've used this formula:
= DATE( YEAR( rng_ReportPeriod ), MONTH (rng_ReportPeriod + 1 ), DAY( rng_ReportPeriod )
If the next month has the same number of days in it, it works fine, thus if rng_ReportPeriod were 7-31-18, the returned result would be 8-31-18
But in a month like March that has 31 days, if I increment by 1 month, instead of 4-30-18, I get 5-1-18.
I DO understand why this is happening, but I DON'T know what to do about it.
In short - I need to take a given date (which will be last day of the month), increment the month by a series of whole numbers, and ALWAYS get the last day of the month.
Thanks for any help.
Jase.
I have a named range "rng_ReportPeriod" that I manually assign a value to on a monthly basis, and it is ALWAYS the last day of the current month.
Thus, currently rng_ReportPeriod is 3-31-18
Elsewhere in my spreadsheet, I need to increment the months by 1, 2, 3 ... 11
So for the area of the spreadsheet where I need to increment by 1, when rng_ReportPeriod is 3-31-18 (as is currently) I need the resulting 1 month increase to return 4-30-18
I've used this formula:
= DATE( YEAR( rng_ReportPeriod ), MONTH (rng_ReportPeriod + 1 ), DAY( rng_ReportPeriod )
If the next month has the same number of days in it, it works fine, thus if rng_ReportPeriod were 7-31-18, the returned result would be 8-31-18
But in a month like March that has 31 days, if I increment by 1 month, instead of 4-30-18, I get 5-1-18.
I DO understand why this is happening, but I DON'T know what to do about it.
In short - I need to take a given date (which will be last day of the month), increment the month by a series of whole numbers, and ALWAYS get the last day of the month.
Thanks for any help.
Jase.