Excel Formula: Display Years from Two Dates (Same or Different)
This formula checks if the year in cell A1 is the same as the year in cell B1. If they are the same, it returns only the year. If they are different, it returns a string with both years separated by a hyphen.
For example, if A1 contains the date '01/01/2021' and B1 contains '12/31/2021', the formula will return '2021'.
If A1 contains '01/01/2021' and B1 contains '12/31/2022', the formula will return '2021-2022'.
原文地址: https://www.cveoy.top/t/topic/nKpv 著作权归作者所有。请勿转载和采集!