Skip to main content

How to delete blank cells and move data left in Excel?

Author Sun Last modified

Working with datasets in Excel often leads to the presence of unwanted blank cells scattered among your data. These blank spaces can disrupt calculations, sorting, or analysis, especially when you want your data entries to be neatly aligned without gaps. Manually removing each blank cell and shifting the remaining content to the left can be extremely time-consuming and prone to error if you have a large volume of information. This tutorial introduces several quick and efficient methods to delete blank cells in a data range and move the remaining cells to the left, ensuring your worksheet remains tidy and more suitable for further processing or analysis. The following solutions cater to different needs, whether you prefer manual, formula-driven, or programmable approaches. Understanding the strengths and trade-offs of each method can help you choose the most appropriate one for your reality.

original data  arrow right delete blank cells and move data left

Go To feature - Delete blank cells and move left
Excel Formula - Remove blanks and shift data left
VBA Code - Automatically delete blank cells and shift data left


Go To feature - Delete blank cells and move left

When you want to delete blank cells and shift the remaining data towards the left, Excel provides a built-in method that is quick for relatively small, consistent ranges. This approach is especially practical if you prefer not to use formulas or programming. However, it is most suitable for basic one-off cleanups rather than automated solutions or very large datasets. Here’s how to accomplish this task step by step:

1. Select your data range that contains the blank cells you wish to remove. This could be a single row, multiple rows, or an entire area. Then, press Ctrl + G to display the Go To dialog. In this window, click Special to further refine your selection. See screenshot:
enable Go To dialog, and click Special

2. In the Go To Special dialog box, check the Blanks option, and click OK. This step highlights all empty cells within your selected range. See screenshot:
check Blanks option in the dialog box

3. With all blank cells now selected, right-click on any one of the selected blanks and choose Delete from the context menu. See screenshot:
 select Delete from the context menu

4. In the Delete dialog, select the Shift cells left option and click OK. This action causes all the data to move left, neatly filling the previous gaps created by the blank cells. See screenshot:
check Shift cells left option in the dialog box

After completing these steps, the blank cells will be removed and the remaining data will be shifted left, as illustrated below:

original data arrow right delete blank cells and move data left
This manual selection-and-delete method is ideal for quick editing of moderate-sized datasets, with immediate visible results. However, be aware of the following considerations: if your range includes merged cells, this method may produce an error, and if you have formulas linked to the cells, deleting cells could affect calculation references. Always review your data structure before committing changes.

Excel Formula - Remove blanks and shift data left

For situations where you want a dynamic, formula-driven solution—such as eliminating blanks from rows or columns, and having the results update automatically when source data changes—Excel formula like FILTER (Excel 365 and Excel 2021) can be very effective. This approach is especially useful for generating a new range without blank cells, meaning you can keep your original data intact while getting a blank-free, left-shifted version elsewhere in your worksheet.

Note: The specific formulas available will depend on your version of Excel. The FILTER function is only available in newer versions (Excel 365, Excel 2021 or later).

1. Suppose your data is in A1:E10 (horizontally). To create a new row without blanks, select an empty cell where you want the output, for example, F1, and enter the following formula:

=FILTER(A1:E1, A1:E1 <> "")

This formula collects only the non-blank cells from A1:E1 and lists them left-aligned starting at F1.

2. Press Enter and the non-blank data will auto-populate leftward in the new range. Then, drag or copy the formula down.

Applicable scenario: This method is recommended when you want to keep your source data unchanged and automatically create a cleaned-up range somewhere else. However, one limitation is that it does not overwrite the original data—instead, it provides a "virtually" shifted version of the data.

Practical tip: If you wish to keep only values in your new range, after applying the formula, copy the results and use Paste Special > Values to overwrite the original range, if needed. Always ensure cell references are adjusted if you copy formulas to other areas.


VBA Code - Automatically delete blank cells and shift data left

If you frequently need to delete blank cells and shift the remaining entries to the left—especially across large or irregularly-sized datasets—a VBA macro can automate this repetitive task. This approach processes cells in place, physically removing blanks so the data is "compacted" to the left within each row. Macros save time and help avoid manual errors when handling complex worksheets.

1. Open the VBA Editor by clicking Developer Tools > Visual Basic. In the Microsoft Visual Basic for Applications window that appears, click Insert > Module, and paste the code below into the module area:

Sub DeleteBlanksShiftLeft()
    Dim WorkRng As Range
    Dim RowRng As Range
    Dim xTitleId As String
    Dim i As Long, c As Long
    Dim TempList As Collection
    Dim Cell As Range
    xTitleId = "KutoolsforExcel"
    On Error Resume Next
    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox("Select range to process (rows will be processed individually):", xTitleId, WorkRng.Address, Type:=8)
    On Error GoTo 0
    If WorkRng Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    ' Process each row individually
    For Each RowRng In WorkRng.Rows
        Set TempList = New Collection
        ' Collect non-empty values in the row
        For Each Cell In RowRng.Cells
            If Trim(Cell.Value) <> "" Then
                TempList.Add Cell.Value
            End If
        Next Cell
        ' Clear entire row first
        RowRng.ClearContents
        ' Refill row with collected values from left to right
        For i = 1 To TempList.Count
            RowRng.Cells(1, i).Value = TempList(i)
        Next i
    Next RowRng
    Application.ScreenUpdating = True
    MsgBox "All blank cells in rows have been removed and values shifted left.", vbInformation
End Sub 

2. After inserting the code, click the Run button button, or press F5 to run the macro. When prompted, select your target range. The macro will process each row, shifting left the values to fill blanks and removing empty cells along the way.

Applicable scenario: Macros are best for users comfortable with enabling and using VBA, especially when routine removal of blanks is required on large data ranges, or in templates that are reused. This method actually modifies the original data, so it is recommended to back up your worksheet beforehand. Be cautious if your data structure is irregular or contains formulas, as the macro works on values and may disrupt underlying dependencies.

Troubleshooting tip: If unexpected results occur, it may be due to merged cells, formula outputs, or protected cells. Unmerge, unlock, or clear formulas as needed before running the macro.

Summary suggestion: Whenever possible, choose formulas for dynamic, non-destructive data transformation, and macros for batch in-place editing. Always save a copy of your data before running automation, and check the result to ensure your worksheet layout remains as intended.


Batch insert blank rows or columns in a specific interval in Excel range

If you want to insert blank rows in every other row, you may need to insert them one by one, but the Insert Blank Rows & Columns of Kutools for Excel can solve this job in seconds. Click for 30 days free trial!
doc insert blank row column
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

Relative Articles

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!