=IFYEARA1=YEARB1YEARA1YEARA1&-&YEARB1
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/dHCp 著作权归作者所有。请勿转载和采集!