How To Remove Duplicates In Google Sheets

Google Sheets is a powerful tool that can help you organize and analyze data efficiently. However, dealing with duplicate data can be a real headache. That’s why I’m here to guide you on how to remove duplicates in Google Sheets.

Method 1: Using Google Sheets’ Built-In Feature

Google Sheets offers a built-in feature to remove duplicates that is very easy to use. Here’s how:

  1. Open your Google Sheets document.
  2. Select the range of cells where you want to remove duplicates.
  3. Click on Data in the menu, then choose Remove duplicates.
  4. A dialog box will appear. Choose if you want to include the first row (header) in the removal process. Click Remove duplicates.
  5. Finally, click Done.

And voila! Google Sheets will have automatically removed all duplicates in your selected range.

Method 2: Using a Script

If you have some coding knowledge, you can use a script to remove duplicates. Follow these steps:

  1. Open your Google Sheets document.
  2. Click on Extensions in the menu, then Apps Script.
  3. In the Apps Script, insert the following script:
  4. function removeDuplicates() {  
      var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
      var data = sheet.getDataRange().getValues();
      var newData = [];
      for (var i in data) {
        var row = data[i];
        var duplicate = false;
        for (var j in newData) {
          if (row.join() == newData[j].join()) {
            duplicate = true;
          }
        }
        if (!duplicate) {
          newData.push(row);
        }
      }
      sheet.clearContents();
      sheet.getRange(1, 1, newData.length, newData[0].length).setValues(newData);
    }
    
  5. Click on File then Save. Name your new project.
  6. Close the Apps Script Editor.
  7. Back in Google Sheets, click on Extensions, then Apps Script, then select your project and click on Run.

Your duplicates should be removed with this method as well. Remember that since this method involves scripting, it should be used by those who are confident with coding or have a basic understanding of it.

Wrap Up

As you can see, Google Sheets provides multiple ways to help you keep your data clean and organized. Whether you are a beginner or a pro, these methods can help you remove duplicates effectively. So, say goodbye to duplicate data and hello to clean, organized sheets!