Search code examples
sortinggoogle-sheetsfilterflattentextjoin

Remove duplicates, with a increasing counter


I have a list, green is the unfiltered data. I tried using SORTN function to remove the duplicates indicated by the incrementing "Counter" column. Found a few solutions online that pointed me towards using something like

=sortn(sort(I2:N,2,0),rows(J2:J),1,2,0)

But I can't get it to remove the extra data, I made a seperate sheet with the desired results. ANy help is appreciated. I thought of using a Query function but I couldnt get it to work either.

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


Solution

  • try:

    =FILTER(A3:H, REGEXMATCH(B3:B&" "&C3:C&" "&H3:H, 
     JOIN("|", FLATTEN(QUERY(TRANSPOSE(
     SORTN(SORT({B3:C, H3:H}, 3, 0), 9^9, 2, 2, 0)),,9^9)))))
    

    enter image description here