Tables Part 2: Stickiness, Structured Selection, And More

One of the key benefits of tables is how other features in Excel 12 behave more predictably and more like you would expect when a table is present.  This is made possible by the fact that Excel knows exactly where the table starts and ends, where the header row is, which cells make up the data and which columns they belong to, where the total row is, etc.  So how exactly does this benefit the user?  Here are some of the different ways in Excel’s awareness of the structure of your data changes the user experience.

Stickiness

When a user does something to a column of data in a table, it "sticks".  What exactly does that mean?  If, for example, a user applies a conditional format to an entire column of a table, Excel assumes that the conditional format is always meant to cover the entire table column.  So as new rows are added to the table, either in the middle or at the end, and as rows are deleted, Excel will automatically extend or contract the conditional formatting rule appropriately.  The rule “sticks” to the column.  We already saw this with the example in my previous post, but it doesn’t just stop with conditional formatting.  This concept works with just about anything you can apply to a column, such as formatting (anything in the Format Cells dialog), cell protection, data validation, etc.  In addition, this behaviour also applies to anything that holds on to a reference, such as formulas, charts and PivotTables.

How do you make something “sticky”?  There’s no explicit gesture for this.  Excel just assumes that anytime something is done to an entire column, the setting is meant to always follow the column.  So, if a user selects a table column and applies a data validation rule, that rule will grow and shrink with the table.  Create a PivotTable that uses a table as its data source, and that Pivot Table will automatically pick up new rows from the table.  Ditto for charts.  To be precise, when I say “entire column” in this context, I really mean all the data rows.  It is not necessary to also include the header cell - this way you don’t have to include the header in order to, for example, make the “currency” number format stick to a column for example.

This stickiness also applies to new columns.  For example, if a table is used as the data source for a chart, then any new columns I add to the table will get picked up by the chart.  In addition, properties set on the entire table, headers, and the total row (more on what a total row is in a later post) are also "sticky". 

Selection

Now that Excel recognizes things like rows and columns in my tables, it is only natural that it provide simple ways to select those elements of a table.  A single mouse click can select one or more rows, one or more columns, or the entire table.  To select a column in a table, simply hover the mouse over the top of the header until the mouse cursor turns into a down-arrow and click.


(Click to enlarge)

To select a row, hover the mouse over to the left edge of a row until the mouse cursor turns into a right-arrow and click.  And to select the entire table, hover the mouse over the top-left corner of the table until you see an arrow that points down and right and click.


(Click to enlarge)

Note that column and table selection have two behaviours.  The first click always selects just the data portion of the column/table.  This makes it easy to select a column of numbers and apply formatting or other properties to the data in the column.  The second click expands the selection to cover everything in the column/table, header and all.  This is useful for copy/paste operations or rearranging columns in a table.

If you are a keyboard junkie (like many of the people reading this seem to be), note that there is keyboard support for these selection behaviours.  The existing shortcut keys for row and column selection, SHIFT+SPACE and CTRL+SPACE respectively, have been modified to work with tables.  For example, pressing CTRL+SPACE once selects all the data rows in a table column.  The second press expands the selection to encompass the entire table column, and the third press expands it again to encompass the entire worksheet column.

What Column am I in again?

This is one of my favorites.  When working with large data sets, it’s easy to scroll the headers off the screen and forget which column you are looking at, especially if many of the columns have similar data in them.  Once you have declared something a table in Excel 12, this problem will go away - when navigating a large table and the table’s headers have been scrolled off the screen, Excel will insert the table headers into the sheet header row where the A, B, C headings appear (see the screen shot below).  For example, when I scroll this table upwards …


(Click to enlarge)

… the header text shows up in place of the sheet headers.


(Click to enlarge)

This makes it much easier to keep track of things without having to split screen/freeze panes.  Note, the table headers will only be visible as long as the active cell is somewhere inside the table.  If you select outside the table, the standard A, B, C headers return.

More Conditional Formatting Goodness

Back at the start of my conditional formatting posts, I said that one of the things we set out to do was to provide a better experience in Tables - lowering the bar for conditional formatting rules that previously required formulas or fiddling.  Here are two features we added to conditional formatting when a user is working with a table.

First, we added a “format entire row” option that appears when defining a conditional format rule on a table. 


(Click to enlarge)

When this option is turned on, the entire table row will be highlighted when a condition is met within a specific column.  Achieving this in the past required more advanced knowledge of conditional formatting.  Now you can treat it like any simple rule – just select the olumn you are interested in evaluating, and select this option if you want the result to show across the entire row.

Second, we added a “compare columns” rule to the list of rules available when setting up conditional formatting on tables.  This rule allows you to format cells of a table column based on comparisons with values in another column – you can use this, for example, to highlight any rows where the values in the “2005 Profits” column are less than the values in “2004 Profits” column.  Again, the fact that Excel knows that there are columns in your table makes it possible to surface very easy UI to quickly set up these sorts of conditions.


(Click to enlarge)

That’s it for now.  In my next table post I’ll go into all the work we’ve done around tables, formulas, and referencing.

Office Blogs Comments

Comments: (22) Collapse

  • Hello there,

    Harlan – Yes, a table can span an entire worksheet, although the memory requirements would be huge.  Yes, delete entire row also deletes table rows.  If you try and insert a range of cells that partially overlaps the table, we prevent the insert, because it would invalidate the structure of the table.  Yes, you can do things like INDEX(Table,ROWS(Table),COLUMNS(Table)) – more on referencing tables in next post.  To answer your question about the active cell not being on the screen, if the active cell is in the table but the entire table is scrolled off screen you will see the A, B, C headers.  If the worksheet row that contains the table header is hidden, the table headers will still appear in the worksheet header space when the headers are scrolled off screen.  To answer your final couple of questions, the font in the worksheet header space never changes, and if a table header value is too large to display in the worksheet header it gets clipped.  “since I'm on a roll, if the table is narrower than the window, will the column header show the table header only in the table's columns and the normal column letters in the columns on either side of the table? If so, will there be any visual cue to distinguish 1, 2 or 3 letter column names in the table header (e.g., ID) from column letters outside the table?”  Yes to your first question, no to your second.

    Jean - Yes, if you select an entire table column you can rearrange that column simply by drag and dropping – we reversed the old default (for tables only) that requires holding down shift to “cut and insert”.  In addition, Excel allows columns in a table to be rearranged even while in a filtered state.  It is possible to use the old trick of pressing ALT+ENTER to insert line breaks, but otherwise the header row is limited to one physical spreadsheet row.  You can use the Formatting Rules dialog as a conditional formatting legend at any time.  Filter being available on the sheet header is a great idea, but it will not be there in Excel 12.  Thanks for the suggestion about filtering using header names.

    Mpemba - The answer is “yes and no”.  Single-cell array formulas and tables work well together, and as you’ll see in my next post, you can make formulas inside a table grow and shrink with the table itself.  Unfortunately multi-cell array formulas are currently not supported inside tables.

    Tianwei – Next post on name defining, I promise.

    SteveA – Thanks for the toggle headers idea.  What specifically are you looking for with respect to data types?  I will pass on your thoughts to the team that handles Help.  Their GPM also writes a blog that has some info on Office 12 help on it.  blogs.msdn.com/mikekelly

  • Has there been any thought to making table the base working unit as opposed to worksheet. I find it interesting that we're finaling moving to a place where the schema is key part of the document and not the canvas.

    Any thought to allowing other types of controls on cells other then text boxes and select controls? What about date pickers? Also where do you see Excel ending and Access beginning? With the advent of tables in Excel it seems that Excel is starting to become Access with a better UI, formulas, and charting. My guess is that formulas is really the defining portion, but even that line is being blurred as we start to focus more on tables since it's less and less likely that formulas will change between data rows.

    And lastly, two requests: One is can we get filtering past two items on tables? And second can we get sorting based on order in a list of choices.

    I have a column in a current Excel list that limits values to one of five states in a process, but when sorting it uses the names of eh states and not the order of the list. This has come up on many occasions for me.

  • In response to Orion,

    Leave spreadsheets spreadsheets. It's fine to add database-like functionality to Excel as long as it doesn't have to be used. If I want to use tables exclusively, I'll use Access.

    That said, it'd be interesting to be able to replace *SOME* worksheets with tables (thus my questions about tables spanning worksheets), but don't replace them as the default construct.

    Unless the new tables provide new formula-based filtering, they're not going to provide any better row referencing than current worksheet cells.

  • Another thought.

    Currently when you filter down a list it hides full rows. While this may be occasionally useful, treating each table as a separate canvas and just showing and hiding cells in that table and not tables around it.

    Again this comes back to the canvas in question; and a complaint I've had about Excel and all spredsheets for a long time. Excel makes me think about the canvas (the worksheet) far too often. For example I may want to add row to a table on worksheet, but often it can destroy tables under it. Similarly it adding columns may destroy tables to the right. Deletion has the same effect. Lists even prevent you from deleting a row when another list is below it that is wider than it is.

    So my question is why does it work this way? I feel it's because the objects on the canvas are linked through that canvas. As long as they are, then there are going to be problems. This also produces problems when I want to annotate the tables with text or other objects. Shapes and charnts don't use the worksheet as the coordinate system.

    I think there is amazing ground to be made by really examining canvas structures. When people ask for more integration in Office I believe it's because they want to really be able to act on these objects and move them around a unified canvas where each object is a first class citizen. I look to Visual Studio's form designer also as a nice tool for laying out things.

    Either way, there is still a huge amount of advancement that can be made in Office productivity apps. We're barely touching the surface of where we can go with them.

  • SteveA - "We're making Developer content a separate search scope, both for offline content and online content" ... see blogs.msdn.com/mikekelly

    Orion - Intersting questions, and I agree - there is plenty of exciting work to be done.  We have some thoughts on controls, but nothing in Excel 12.  Oh, and yes to your two filter questions - give me two more posts.

  • Hi David

    Regarding data types

    It would be good to have 64bit and possibly 128bit integers. Possibly useful for people working with 64bit computers, less for the maths more for bit twiddling. Sadly my days of doing such work are long gone :-)

    Sometime ago I did hit the current integer limit, but can't remember now what I was doing that gave me the problem.

    Also proper support for decimal data type would be cool rather than having it stuck in variants.

    On the help, I will check out the seperate blog. But as an additional example. To find the help for data types, I first looked in the excel help with no luck, so then invoked the visual basic editor and look in the help their.

  • I'd like to see a "key" designator in a table - that is, select a column and make that column a "key" column (checking/constraining the data in the column are unique entries - could even be autonumbers!), thus facilitating linking the table data to other apps and making write-back quite simple.