Hello. Given a specific day, round it up or down to the nearest half month, that is, either the 15th or 30th. I’m working with the following criteria:
If >=1,<=8, represent as 30th of previous month
If >=9,<=22, represent as 15th of current month
If >=23,<=31, represent as 30th of current month.
For example, 3 May is represented as 30 Apr, 9 May is represented as 15 May, 23 May is represented as 30 May.
I’m only able to get half of it to work. Is the solution found with the IF function or should I be looking at EOMONTH or DATEDIF? This is what I got so far:
=IF(AND(DAY(D2)>=1,DAY(D2)<=8),DATE(YEAR(D2),MONTH(D2),0),DATE(YEAR(D2),MONTH(D2)+0,15))
And not sure how to handle leap year. Thanks.
Bookmarks