How to Delete Empty Cells in Google Sheets (4 Different Ways)

When working in Google Sheets, empty cells often appear in the dataset and can cause several issues. Empty cells may seem unimportant because they don’t contain anything with text, values, or data. However, these cells can lead to calculation errors, broken formulas, or gaps in your data.

Empty cells can appear if a formula didn’t return a result, if the cell was never filled in, or if data was deleted. That’s why it’s helpful to delete empty cells and keep your data error-free and easy to work with.

In this article, we’ll learn some simple methods to delete empty cells in Google Sheets.

Key Takeaways

Here is a step by step guide on how you can delete empty a cell in your spreadsheet:

➤ Open your dataset in Google Sheets and select an empty cell that you want to delete.
➤ Right-click on it and a popup dropdown menu will appear.
➤ Scroll down and click on Delete cells.
➤ A side menu will appear with two options: Delete cells and shift left and Delete cells and shift up.
➤ Select the option you want. If you click on the first option, the empty cell will be deleted and the data will shift left. If you click on the second option, the empty cell will be deleted and the data will shift up.

overview image

Download Practice Workbook
1

Using Data Sort Range Method

In the following dataset, there are four columns with random items and some columns have several empty cells. We’ll remove all empty cells from those columns using some simplest method and here’s the first one.

Using Data Sort Range Method

The easiest method to remove empty cells is to use the Sort Range option. This method sorts the data from the selected range and separates the blank cells.

Steps:

➤ Select the range of cells where you want to remove blank cells. For example, select cell D2 to D13.

Using Data Sort Range Method

➤ Go to the top Menu and click on Sort range >> Sort range by column D (Z to A).

Using Data Sort Range Method

➤ Now you will see all the non-empty cells in column D will move to the top, and the blank cells shift to the bottom..

Using Data Sort Range Method

➤ Follow the same method for the rest of the empty cells in other columns. Now you’ll see all the non-empty cells placed at the top and the empty cells shifted to the bottom.

Using Data Sort Range Method

Note:
When you select the option Sort range by column (Z to A), it will move all the blank cells in the column to the bottom and place the filled cells at the top. If you select the option Sort range by column (A to Z), it will bring the blank cells into the top, and move the filled cells to the bottom.


2

Using The FILTER Function To Remove Empty Cells

The FILTER function is a simple and effective way to remove empty cells. This method doesn’t delete the original data but creates a new list of the cells with data.

Here’s a step by step guide to apply this function:

➤ Choose an empty cell from your spreadsheet where you want the filtered data that doesn’t contain any empty cell. For example, select the cell E2 where apply the formula for the output of Column C.

Using The FILTER Function To Remove Empty Cells

➤ Type the formula

=Filter(C2:C13, C2:C13 <> “”)

Using The FILTER Function To Remove Empty Cells

➤ Press Enter. Now you’ll get a new filtered list of Column C without any empty cells.

Using The FILTER Function To Remove Empty Cells


3

Using Delete Cells Options In Google Sheets

This is one of the easiest and most commonly used methods for deleting empty cells. You can delete a single cell or multiple cells at a time.

Here is a step by step guide on how you can delete empty a cell in your spreadsheet:

➤ Open your dataset in Google Sheets and select an empty cell that you want to delete. For example, select cell B3.

Using Delete Cells Options In Google Sheets

➤ Right-click on it and a popup dropdown menu will appear.
➤ Scroll down and click on Delete cells. A side menu will appear with two options: Delete cells and shift left and Delete cells and shift up.

Using Delete Cells Options In Google Sheets

➤ Select the option you want. If you click on the first option Delete cells and shift left, the empty cell will be deleted and the data will shift left.

Using Delete Cells Options In Google Sheets

➤ If you click on the second option Delete cells and shift up, the empty cell will be deleted and the data will shift up.

Using Delete Cells Options In Google Sheets


4

Using Google Apps Script

If you’re comfortable using scripts, this method lets you delete empty cells and shift everything up in the same column or range. It’s a great option when you want fast and automatic results.

Here is a simple step by step guide how you can apply Apps Script:

➤ Go to the top Menu from your spreadsheet.
➤ Click Extensions >> Apps Script.

Using Google Apps Script

➤ Delete the previous script and paste this script:

function deleteEmptyCellsAndShiftUp() {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  const range = sheet.getRange("A2:D13"); // Adjust range based on your dataset
  const values = range.getValues();
  let cleaned = [];
  // Loop through each column
  for (let col = 0; col < values[0].length; col++) {
    let nonEmpty = [];
    // Collect non-empty values from each column
    for (let row = 0; row < values.length; row++) {
      let cell = values[row][col];
      if (cell !== "" && cell !== null) {
        nonEmpty.push([cell]);
      }
    }
    // Fill up the column to original length with empty strings
    while (nonEmpty.length < values.length) {
      nonEmpty.push([""]);
    }
    cleaned.push(nonEmpty);
  }
  // Reconstruct cleaned columns back into rows
  let finalValues = values.map((_, rowIndex) => {
    return cleaned.map(col => col[rowIndex][0]);
  });
  // Set the cleaned data back into the sheet
  range.setValues(finalValues);
}

➤ Next, click the Save icon so you can Run the script.

Using Google Apps Script

➤ Once you save the script, the Run icon will be enabled to use. Now click on Run.

Using Google Apps Script

➤ The first time you run a script, Google will ask for permission to allow the script to make changes to your spreadsheet.
➤ After allowing the permissions the script starts Execution and it takes a few seconds to complete the process.

Using Google Apps Script

➤ Now you’ll see that Google Sheets removes the empty cells and shifts up the range of cells you selected.

Using Google Apps Script


Frequently Asked Questions

How do I Delete a lot of cells in Google Sheets?

To delete multiple cells at once follow the below steps:

➤  Select the range you want to remove
➤ Right-click, and choose Delete cells.
➤ Then select an option from the side menu: Delete cells and shift left or Delete cells and shift up.

Can I automatically remove blank cells in Google Sheets?

You can use both Apps script and the Filter function to delete empty cells. The FILTER function to create a clean list that excludes blank cells. On the other hand, Google Apps Script automatically removes empty cells and shifts the rest of the data upward.


Wrapping Up

Empty cells in Google Sheets can affect the flow and accuracy of your data. In this article we’ve mentioned several functions to remove blank cells and make your spreadsheet more presentable. Using these methods will help you avoid errors in calculations and improve the overall readability of your data.

ExcelInsider Team
We will be happy to hear your thoughts

Leave a reply

Excel Insider
Logo