Since we have two columns here, join them using the ampersand. We want to remove duplicates based on two selected columns, and they are A2:A6 (authors) and B2:B6 (book titles).Įarlier, we used A2:A6 as the sort_column. It’s simple if you have followed the above examples with patience. Removing duplicate rows based on selected two or more columns is not rocket science in Google Sheets. Removing Duplicate Rows Based on Selected Two Columns So the SORTN range will be chooserows(A2:B6,sequence(rows(A2:A6),1,-1,-1)). We can use the CHOOSEROWS function for that. We require to flip the data before applying the SORTN. What will we do if we want to keep the last occurrence of the row? Here we can also use the column index number, which is #1 here. It’s the column that decides the duplicates. Usually, experts use 9^9, an arbitrarily large number, because of unsure about the number of rows after removing duplicates based on the selected column. It’s the total number of rows in the range. Single-Column Formula (First Occurrences): =sortn(A2:B6,5,2,A2:A6,FALSE) The following Google Sheets formula will keep only the first occurrence of the titles from column A.