google-sheetsuniqueyearmonth

List unique years from a set of dates in google sheets


I am currently achieving the process of extracting unique years from a range of dates with the use of helper columns shown here:

enter image description here

Is it possible to achieve the same using just a single formula?

Here are the three formulas I am currently using:

S column: =UNIQUE('Earnings Input'!A2:A) T column: =YEAR(S1) U column: =UNIQUE(T1:T)

Appreciate any help I can get!


Solution

  • As there is no link to your spreadsheet, this is untested, but you can try this:

    =ArrayFormula(SORT(UNIQUE(YEAR(FILTER('Earnings Input'!A2:A,ISNUMBER('Earnings Input'!A2:A))))))

    FILTER( ,ISNUMBER( )) filters in only values that could reasonably be a date.

    YEAR gets the years for those entries.

    UNIQUE reduces to the unique listing

    SORT assures the results will be in ascending order.