How to Fill Blank Cells with the Previous Account Number in Excel
Question details
The user needs to populate empty cells in a column with the last non-empty account number directly above them until a new account number appears in the list.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Organizing raw datasets where group labels like account numbers are only entered once at the top of a group, leaving the rows below it blank.
- Observed behavior
- Account numbers appear only once per grouping, leaving subsequent rows empty, which prevents accurate sorting, filtering, or pivot table generation.
Before applying bulk filling techniques, ensure you have selected only the specific data range you want to modify to avoid accidentally filling unintended blank cells elsewhere in your worksheet.
Use 'Go To Special' to Fill Blanks with the Cell Above
This is the most common and efficient method to fill empty cells with the value directly above them using Excel's built-in navigation tools.
The 'Go To Special' tool allows you to isolate only the blank cells within your selected range. By applying a relative formula to these selected blanks, you can instantly pull down the account number from the row above.
Highlight the entire column or the specific range of cells that contains both the account numbers and the blank cells you wish to fill.
Press 'F5' on your keyboard to open the 'Go To' dialog box, then click on the 'Special...' button in the bottom left corner.
In the Go To Special window, select the radio button next to 'Blanks' and click 'OK'. All empty cells in your range will now be highlighted.
Without clicking anywhere else on the sheet, type the equals sign '=' and press the 'Up Arrow' key on your keyboard. This creates a reference to the cell immediately above the first active blank cell.
Hold down the 'Ctrl' key and press 'Enter'. This will instantly copy your formula into every highlighted blank cell, pulling the account numbers down.

Fill Blanks Using the IF Formula
A simple formula approach that uses a helper column to carry down the last non-blank account number.
Use SCAN for Dynamic Arrays (Excel 365)
For users on modern Excel versions, the SCAN function offers a robust, dynamic array solution to fill blanks automatically.
Easily Fill Blank Cells in WPS Office
WPS Spreadsheet provides robust data management tools, including the 'Go To Special' feature, allowing you to fill blank cells with previous account numbers in seconds. Enjoy a familiar interface to process your data without any learning curve.
- 1. Select the Data: Open your spreadsheet in WPS Office and highlight the column containing the account numbers and blanks.
- 2. Use Go To Special: Press Ctrl + G to open the 'Go To' dialog, select 'Blanks', and click 'Go To' to highlight empty cells.
- 3. Input the Reference: Type '=' and press the Up Arrow key to reference the account number cell directly above.
- 4. Apply Everywhere: Press Ctrl + Enter to instantly populate all the highlighted blank cells with the correct account numbers.

Frequently Asked Questions
Why do I get an error when I press Ctrl+Enter after selecting blanks?
This usually happens if you accidentally click on a cell with your mouse after using the 'Go To Special' > 'Blanks' command, which deselects the highlighted empty cells. Make sure to type the equals sign (=) immediately after clicking OK in the dialog, without clicking anywhere else.
How can I prevent the filled cells from changing if I sort the data?
Because the filled cells rely on formulas pointing to the cell above them, sorting the data will break the sequence. Before sorting, you must convert the formulas to text. Select the filled column, press Ctrl+C to copy, right-click the selection, and choose 'Paste as Values'.
Is it better to fill the blanks or restructure my spreadsheet?
While filling blanks is an excellent quick fix for pivot tables and filtering, repeating group labels with empty rows is generally considered poor data design. For long-term reliability, it is highly recommended to store your data in a normalized table where every row contains a complete record.




