Function Problems

How to Remove Blank Cells and Shift Values Up Using Excel Formulas

Natalie TaylorNatalie Taylor Nov 11, 2026 869 views

Question details

The user wants to compact a table by extracting all non-blank values and shifting them upward to fill empty cells while preserving the original column structure.

How to Remove Blank Cells and Shift Values Up Using Excel Formulas
Product
Microsoft Excel
Device & OS
not provided
Scenario
Cleaning up and organizing a dataset that contains scattered blank cells across various rows and columns without manually deleting them.
Observed behavior
The table currently contains blank cells, and the goal is to shift all data up to create a contiguous, gap-free table via automated formulas.
Before you start

Determine whether you are using a modern spreadsheet version that supports dynamic array functions (like TOCOL and WRAPROWS) or a legacy version, as the required formulas differ significantly.

Solution 1Recommended

Use Dynamic Array Formulas (Modern Spreadsheets)

The most efficient way to remove blanks and shift values up is by combining the LET, COLUMNS, TOCOL, and WRAPROWS functions.

This method utilizes dynamic arrays to automatically spill the results into adjacent cells without the need for manual dragging. The TOCOL function extracts all values into a single column while ignoring blanks, and WRAPROWS reconstructs the table.

1
Select the destination cell

Click on the top-left cell of the new range where you want the compacted table to appear.

2
Enter the dynamic formula

Type the formula: =LET(c,COLUMNS(Table2),vector,TOCOL(Table2,1),WRAPROWS(vector,c)) into the formula bar. Replace 'Table2' with your actual data range.

3
Apply the formula

Press Enter. The formula will automatically calculate and spill the compacted data, shifting all non-blank values up while maintaining the column count.

Use Dynamic Array Formulas (Modern Spreadsheets)
Understanding the formula: The '1' inside the TOCOL function is the specific argument that commands Excel to ignore blank cells during the vector transformation.
Seamless Data Management

Manage Data and Remove Blank Cells Easily with WPS Spreadsheet

WPS Office provides robust spreadsheet tools that handle complex formulas, dynamic arrays, and large datasets effortlessly. You can compact your tables and clean up data efficiently without needing expensive software.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open your existing .xlsx workbook containing the data with blank cells.
  2. 2. Select your target range: Click on the cell where you want the new, compacted table to be generated.
  3. 3. Input the extraction formula: Type the appropriate array formula for your data layout directly into the formula bar.
  4. 4. Execute the formula: Press Enter to instantly execute the dynamic array and shift all non-blank values upward.
Fully compatible with Microsoft Excel (.xlsx) formats and legacy formulasSupports advanced data processing and modern dynamic array functionsLightweight application that runs smoothly even on older devicesCompletely free core spreadsheet features with a familiar interface
microsoft office alternative - wps office

Frequently Asked Questions

Can I remove blank cells without using complex formulas?

Yes. You can select your data range, press F5 to open the 'Go To' dialog, click 'Special', select 'Blanks', and click OK. Then, right-click any highlighted blank cell, select 'Delete', and choose 'Shift cells up'. Note that this permanently alters your original data rather than creating a dynamic copy.

Why is my INDEX and SMALL formula returning a #NUM! error?

This error occurs when the formula has successfully extracted all the non-blank values and there is no more data left to return for that specific row. You can wrap your entire formula in an IFERROR function (e.g., =IFERROR(your_formula, "")) to display a blank space instead of the error.

What does the TOCOL function do in the recommended formula?

The TOCOL function transforms a multi-column array or range into a single vertical column (a vector). By setting its second argument to 1, you specifically instruct the spreadsheet to ignore any blank cells during this transformation, which is the key to compacting the data.