Search code examples
google-sheetsexcel-formulagoogle-sheets-formulaspreadsheet

Validation menu from column with dates where options are only the years


I need to create a data validation menu from a range like B:B where the entire column is populated with date and time every 2 hours. I need the menu to output as options only the years without repetition in this case only 2021 and 2022 but when dates from 2023 start being added automatically 2023 is added to the validation menu. Here is a dummy file to exemplify:

https://docs.google.com/spreadsheets/d/1ExXtmQ8nyuV1o_UtabVJ-TifIbORItFMWjtN6ZlruWc/edit?usp=sharing

Is such a thing possible?


Solution

  • This worked on A1 or wherever then point data validation to A:A or etc:

    =SORT(UNIQUE(ARRAYFORMULA(IF(ISBLANK(B4:B),,YEAR(B4:B)))))