This formula checks if the year of the date in column A of Sheet2 is the same as the year of the date in column B of Sheet2. If it is, it returns the year. If not, it concatenates the year of column A with a hyphen and the year of column B to create a range of years.

For example, if Sheet2 has the following dates:

| Column A | Column B | |----------|----------| | 01/15/2020 | 03/05/2020 | | 05/01/2021 | 08/22/2021 | | 11/10/2022 | 02/20/2023 |

The formula would return:

| Result | |--------| | 2020 | | 2021 | | 2022-2023 |

Excel Formula: Comparing Years in Two Columns & Creating Year Range

原文地址: http://www.cveoy.top/t/topic/nKth 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录