How to Make an Excel Table Expand and Shrink Dynamically
Question details
The user wants to set up a hidden or visible worksheet range that automatically expands and contracts when the length of pasted source data changes.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Pasting varying lengths of data into a worksheet and needing downstream tables, formulas, or charts to adjust automatically.
- Observed behavior
- Currently, ranges might be referencing thousands of blank rows to accommodate potential data growth, which is inefficient. The goal is a dynamically resizing range.
Ensure your source data has consistent headers and does not contain completely blank rows or columns in the middle of the dataset, as these can disrupt dynamic range calculations.
Use the Built-in Excel Table Feature
Converting your static data into an official Excel Table is the simplest and most robust way to create a dynamically expanding and shrinking range.
Excel Tables automatically absorb new rows pasted at the bottom and shrink when rows are deleted. Any formulas, charts, or PivotTables connected to this table will respect the new boundaries without requiring manual updates.
Click any cell within your existing source data range.
Go to the 'Insert' tab on the ribbon and click 'Table', or press the keyboard shortcut Ctrl+T.
Ensure the 'My table has headers' box is checked in the pop-up dialog, then click OK.
Paste new data immediately below the last row to automatically expand the table. Delete rows to shrink it. The table styling and boundaries will adjust instantly.

Create a Dynamic Named Range with OFFSET and COUNTA
If you prefer not to use the Table feature, you can define a dynamic named range using the OFFSET function that adjusts based on the count of non-empty rows.
Use Power Query for Imported Data
When your source data comes from pasting files or importing external datasets, Power Query can automatically resize the output table upon every refresh.
Dynamically Manage Spreadsheet Data in WPS Office
WPS Spreadsheet fully supports Excel Tables (Ctrl+T) and dynamic named ranges, allowing you to build dynamically resizing datasets without writing complex VBA code. It seamlessly handles varying lengths of pasted data while maintaining formula integrity.
- 1. Open your dataset: Launch WPS Spreadsheet and open the file containing your source data.
- 2. Convert to Table: Highlight your data block and press Ctrl+T to instantly convert it into a dynamic Table.
- 3. Update your data automatically: Paste new data directly beneath the last row. The table boundaries, formatting, and connected formulas will auto-expand instantly.
- 4. Refresh linked reports: If you have PivotTables linked to this dataset, simply click 'Refresh Data' to process the expanded or shrunken range.

Frequently Asked Questions
Why isn't my Excel Table expanding when I paste data?
Ensure you are pasting the new data directly into the row immediately below the table. If there is a blank row between the bottom of the table and the newly pasted data, the table will not auto-expand to include it.
Can pivot tables shrink automatically when rows are deleted from the source?
Yes. If your PivotTable's data source is formatted as an official Table (Ctrl+T) or a dynamic named range, it will perfectly adapt to the shrunken data size when you right-click the PivotTable and select 'Refresh'.
How does using dynamic ranges help with file size and performance?
By using dynamic ranges instead of referencing entire columns (like A:A or rows 1:1048576), the spreadsheet application only calculates cells that actually contain data. This significantly improves calculation speed and prevents your file size from becoming unnecessarily large.
Do dynamic array formulas work across different sheets?
Yes, you can reference a dynamic named range from any worksheet within the same workbook. Just type the defined name in your formulas regardless of which sheet you are currently working on.




