Data Import & Export

Copy a Variable Number of Rows to Another Excel Worksheet

Huma Ashraf ChHuma Ashraf Ch Nov 18, 2026 869 views

Question details

Copy a changing number of source rows to another worksheet without using a fixed range or a macro.

Copy a Variable Number of Rows to Another Excel Worksheet
Product
Microsoft Excel
Device & OS
not provided
Scenario
A source worksheet gains or loses rows, and a destination worksheet needs to display the matching data.
Observed behavior
The destination should expand or contract as the number of qualifying source rows changes.
Before you start

Identify a column that contains a value for every row you want to copy, and check whether your Excel version supports FILTER. Make sure the destination has empty cells below and to the right of the formula.

Solution 1Recommended

Use FILTER with an Excel table

Use a dynamic formula to display qualifying rows and automatically include new rows added to the source table.

This example assumes the source table has six consecutive columns, from ID through F, and that ID is populated for every row to include. Replace the table and column names with your own.

1
Create the source table

Select the source data and headers, choose Insert > Table, and confirm that the table has headers.

2
Name the table

Click inside the table and use Table Design > Table Name to name it SourceData. Check the first and last column headers for the range you want to return.

3
Enter the FILTER formula

On the destination worksheet, select an empty cell and enter =FILTER(SourceData[[ID]:[F]],SourceData[ID]<>"",""). Replace ID and F with your actual column headers.

4
Add or remove source rows

Add new records directly below the source table or delete table rows. The FILTER result will expand or contract as qualifying rows change.

Use FILTER with an Excel table
Keep the spill area clear: Enter the formula outside an Excel table. If Excel displays #SPILL!, clear any cells blocking the result. The formula returns a live result rather than independently editable copies.
Work with spreadsheets in WPS

Display changing source rows in WPS Spreadsheets

Use a table-based FILTER formula in a version of WPS Spreadsheets that supports FILTER and structured table references to display qualifying rows on another worksheet.

  1. 1. Open the workbook: Open the Excel workbook in WPS Spreadsheets and select the source data and its headers.
  2. 2. Create and name a table: Choose Insert > Table, confirm the headers, and name the table SourceData using the table tools.
  3. 3. Enter the formula: On the destination sheet, select an empty cell and enter =FILTER(SourceData[[ID]:[F]],SourceData[ID]<>"",""). Replace the column names with those in your table.
  4. 4. Check the result: Add a populated row to the source table and verify that it appears on the destination sheet. If the formula is not recognized, check whether your WPS version supports FILTER and structured references.
Display matching source rows without a VBA macroWork with Microsoft Excel XLSX filesUse a familiar spreadsheet interfaceGet started with WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

Will FILTER include rows added beyond the original data?

Yes, if you use table references and add the rows to the source table. A formula using a fixed range such as A2:F100 will not include rows beyond row 100.

Why does my FILTER formula show #SPILL!?

Cells in the output area may contain data, or the formula may be inside an Excel table. Clear the blocked cells and enter the formula outside the table.

What if the column used to identify rows contains blanks?

The condition SourceData[ID]<>"" excludes those rows. Choose a column that is populated for every row you need, or change the FILTER condition to match your data.

Can I edit the copied rows directly?

FILTER displays a formula result, so edit the source table to change it. If you need independent values, copy the result and use Paste Special > Values in another location.

What can I use if my Excel version does not support FILTER?

If Power Query is available, use Data > From Table/Range to load and filter the source table, then use Data > Refresh All after source changes.