Insert N Empty Cells Between Values in Excel (Dynamic Array)

Do you want to space out data by inserting a specific number of empty cells between values in Excel? For example, adding 10 blank cells between a list of names? This tutorial will guide you through a dynamic array formula that automatically inserts N empty cells between values in a column. The method can also be adjusted for rows with minor modifications. The formula does not use complex functions or LAMBDA functions, ensuring fast performance.

Understanding the Goal

We want to take a single-column dataset and insert a specified number (N) of blank cells between each value dynamically, without manually inserting rows. This method ensures that updates to the original data are reflected immediately in the output.

Assume you have a list of names in A2:A5 as follows:

Marco
Sherry
Rachelle
Warren

If N = 2, the output should be:

Marco
(blank)
(blank)
Sherry
(blank)
(blank)
Rachelle
(blank)
(blank)
Warren
(blank)
(blank)

You can use the formula in cell C2 after specifying N in cell C1. Let’s proceed with the step-by-step instructions, followed by the formula explanation.

Step 1: Define the Inputs

  1. Original Data Range – Assume your data is in A2:A5.
  2. Number of Empty Cells (N) – Enter the number of blank cells to insert (e.g., in C1).

Here, I am entering 2 in cell C1. You can enter any number starting from 1, depending on your requirement.

Step 2: Construct the Dynamic Array Formula

In cell C2, enter the following formula to generate the spaced-out data dynamically:

=IFNA(TOCOL(HSTACK(TOCOL(A2:A5, 3), T(SEQUENCE(1, C1)))), "")
Example of inserting empty cells between values in a column in Excel using a dynamic array formula

How It Works:

  • TOCOL(A2:A5, 3): Removes empty cells in the range A2:A5.
  • T(SEQUENCE(1, C1)): The SEQUENCE function generates numbers in a row based on the number specified in C1. The T function returns empty cells equal to the number of generated sequence numbers.
  • HSTACK(TOCOL(A2:A5, 3),T(SEQUENCE(1, C1))): Stacks the original list with the generated empty cells, forming a 2D array where the first column contains the original values, and the next columns contain empty cells or #N/A errors.
    Stacking an empty row with a column in Excel
  • TOCOL(...): Converts the 2D array into a single column, placing the values and empty cells or errors in sequence.
  • IFNA(...): Replaces any #N/A errors with blank cells.

Step 3: Adjusting for Rows Instead of Columns

If you want to insert empty cells between values in a row (e.g., B1:E1), instead of a column, modify the formula as follows:

=IFNA(TOROW(HSTACK(TOCOL(B1:E1, 3), T(SEQUENCE(1, B3)))), "")

Where N is specified in B3.

Adding empty cells between values in a row in Excel

Key Change: We replace the outer TOCOL with TOROW to ensure the output remains in a row format instead of a column.

Conclusion

This dynamic array formula provides an efficient way to insert N empty cells between values without manually adjusting the spreadsheet. It updates automatically as your data changes, making it ideal for large datasets or frequently updated lists.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Custom Order for QUERY Pivot Headers in Google Sheets

By default, when you use the PIVOT clause in a Google Sheets QUERY, the...

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

Mode of Comma-Separated Numbers in Excel (Dynamic Array)

There is no dedicated function in Excel to directly find the mode of comma-separated...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

More like this

Mode of Comma-Separated Numbers in Excel (Dynamic Array)

There is no dedicated function in Excel to directly find the mode of comma-separated...

Sort Each Row Individually in Excel Using a LAMBDA Formula

Sorting rows in Excel typically refers to rearranging entire datasets based on values in...

Sort by Field Labels Using the SORT and XMATCH Combo in Excel

Want to sort your Excel data by column names instead of column positions? Learn...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.