The formula below works for all months outside of leap year and every month except February during leap year which returns two additional days of 30 and 31.
The date (2/1/2020) is in cell B2.
O24 (Saturday) contains 29.
C29 (Sunday) contains 30.
E29 (Monday) contains 31.
G29 (Tuesday) contains 1.
The internet seems to explain this as resulting from Lotus 1-2-3 because it had a bug and they wanted to maintain compatibility in Excel. How do I get around this bug?
Code:
IF(O24+1<DATE(YEAR(B2),MONTH(B2)+1,0),O24+1,IF(O24+1=DATE(YEAR(B2),MONTH(B2)+1,0),DATE(YEAR(B2),MONTH(B2)+1,0),1))
The date (2/1/2020) is in cell B2.
O24 (Saturday) contains 29.
C29 (Sunday) contains 30.
E29 (Monday) contains 31.
G29 (Tuesday) contains 1.
The internet seems to explain this as resulting from Lotus 1-2-3 because it had a bug and they wanted to maintain compatibility in Excel. How do I get around this bug?