Update: Here is what I am trying to do. I have 3 columns of random dates; I'd like to combine these in one array and produce a column containing ONLY Friday dates (i.e., for weeks in which a date appears in original 3 columns. Weeks where there is no date should no appear in result column.)
Here is the sample sheet. https://docs.google.com/spreadsheets/d/19_-ML2mCVAMPzfTX0z2BO70wMZemjkWk8uQ71o0OF5Q/edit?gid=0#gid=0
I hope this makes sense. Thank you all for your help.
I tried many online suggestions, but couldn't get it right
The formula transforms all the given dates into Fridays on the corresponding week of the date. Afterwards, the unique function was used to remove duplicate dates.
You may try this:
=LET(a,TOCOL(C7:E27,1),SORT(UNIQUE(ARRAYFORMULA(TOCOL(a,1)+TOCOL(ARRAYFORMULA(6-TOCOL(ARRAYFORMULA(WEEKDAY(a)),1)),1)))))
TOCOL
was used to combine the three columns into one while ignoring all of the empty cells (by setting the second parameter of TOCOL to1
).
WEEKDAY()
was used to get the difference between the given date and the Friday of the corresponding week of the given date. The difference was then added to the given date so that it becomes a Friday.
Output: