Search code examples
google-sheets

google sheets formula, filter unique while keeping the earliest data


I'm trying to remove duplicates from a simple table

4/1/2023    
6/1/2023    
7/1/2023    A
8/1/2023    A
9/1/2023    A
10/1/2023   B
9/15/2023   B
9/15/2023   B
12/19/2023  C
12/17/2023  C
12/19/2023  C
3/13/2024   D
3/13/2024   D

I want the result to look like this

4/1/2023    
7/1/2023    A
9/15/2023   B
12/17/2023  C
3/13/2024   D

Unique column B, while keep the earliest date for the entry

I tried query and filter and unique but still can't get it to work.


Solution

  • You can use:

    =MAP(UNIQUE(B:B),LAMBDA(u,{MIN(FILTER(A:A,u=B:B)),u}))