ICAEW.com works better with JavaScript enabled.
Exclusive

Multiple Excel Tables in a single worksheet – avoiding Cell Clash

Author: Simon Hurst

Published: 17 Mar 2022

Exclusive content
Access to our exclusive resources is for specific groups of students, users, subscribers and members.
I have been working on a project recently for which I wanted to include a set of refreshable Excel Tables in a control worksheet to highlight exceptions in the underlying data. Generally, the best way to avoid Tables clashing with each other as they expand and contract is to keep them on their own, separate, worksheets. In this case, I wanted to create a single workbook that would highlight potential errors at a glance, and the Tables concerned were only likely to generate a few rows each. The following examples demonstrate some of the considerations involved.

Here we have some dummy Tables. Rather than adding and removing data, we will use the Table marker in the bottom right-hand corner of each source Table (in blue) to change the number of rows and then columns in use:

Excel screenshot

If we increase the number of rows in our 3-column source Table, and Refresh our green output Tables, we can see that the top Table expands downwards and automatically moves the 2 column Table beneath down to allow room:

Excel screenshot
However, if we reverse the position of our Two Tables and then increase the number of rows in use in our 2-column Table, we will see that things don't go as well:
Excel screenshot

The problem is that, with fewer columns in the top Table, not all the rows in our green 3-column Table are moved, hence the message that the refresh fails because cells would be moved within a Table, rather than the entire Table being displaced. This would also be a problem if the number of rows in the source Table was reduced rather than increased.

We can avoid the issue by changing the Table Properties. Here we have right-clicked in our 2-column Table, chosen Table, External Data Properties… and then selected the second of the options in the section:

Data formatting and layout, If the number of rows in the data range changes upon refresh:

Excel screenshot
As the description of this option suggests, rather than just inserting cells, this option caused the Table to insert whole rows as it expands, ensuring that it moves the entire Table below, even if it has more columns:
Excel community

As you can see from the above screenshot, this is not perfect as it causes our 2-column Table to overwrite the blank cells separating our two tables as well as moving our 3-column Table down, but at least it does allow the Tables to refresh successfully.

There are similar problems if we arrange our Tables horizontally rather than vertically and we change the number of columns in the source Table. Tables to the right can be moved when the number of columns increases:

Excel screenshot
However, if we then reduce the number of columns in our left-hand Table our error message appears again:
Excel screenshot

In summary, if you do try and combine refreshable Tables in a single worksheet you do need to think very carefully about what will happen should the number of rows and/or columns change. Generally, the number of columns is likely to be more predictable so you could try and ensure your Tables all have the same number of columns, even if it means padding some of the Tables with empty columns. Otherwise, if the number of rows might vary, you will need to arrange the Tables so that Tables with more columns are positioned above those with fewer columns.

There are also some more creative solutions available to deal with the problem. Here, we have used Power Query to add a description column to each of our Tables, set the option in the Home Ribbon tab, Transform group to 'Use Headers as First Row' then Appended our Tables to create a single Table that includes all our exceptions. In the resulting Excel Table, we have turned off the display of the Header Row in the Table Design Ribbon Tab, Table Style Options group, and used Conditional Formatting to set the font of our heading rows to Bold and with a darker fill colour:

Excel screenshot
Archive and Knowledge Base

This archive of Excel Community content from the ION platform will allow you to read the content of the articles but the functionality on the pages is limited. The ION search box, tags and navigation buttons on the archived pages will not work. Pages will load more slowly than a live website. You may be able to follow links to other articles but if this does not work, please return to the archive search. You can also search our Knowledge Base for access to all articles, new and archived, organised by topic.

Open AddCPD icon

Add Verified CPD Activity

Introducing AddCPD, a new way to record your CPD activities!

Log in to start using the AddCPD tool. Available only to ICAEW members.

Add this page to your CPD activity

Step 1 of 3
Download recorded
Download not recorded

Please download the related document if you wish to add this activity to your record

What time are you claiming for this activity?
Mandatory fields

Add this page to your CPD activity

Step 2 of 3
Mandatory field

Add activity to my record

Step 3 of 3
Mandatory field

Activity added

An error has occurred
Please try again

If the problem persists please contact our helpline on +44 (0)1908 248 250