Excel already knows when the month ends.
Sometimes, the YEAR function returns the correct value, but Excel displays an unexpected year, such as 1900 or 1905. This occurs when the cell containing the YEAR formula is formatted as a Date ...
Results that may be inaccessible to you are currently showing.
Hide inaccessible results