Tables: Introduction

Section Goals

At the end of this section you will know how to create a table from a list and be able to identify the various sections of a table.

https://medium.com/codex/the-ultimate-guide-to-excel-tables-1236d826c897

Convert List to Table

We usually start with a list or a partial list and then convert it to a table. There are two main ways to convert a list to a table. They both start with us clicking on any cell in the list:

Table Course Outline


When we convert a list to a table and have selected any cell in that table, Microsoft as a 'contextual' menu called Table Design (shown below).

Naming Tables

Looking at the ribbon above, we can see on the left, a box labeled Table Name:. In that box is the text: Table2. When we convert a list to a table Excel assigns a default name. Excel labels the first table: Table1. It labels the next table: Table2 and so on. These names are meaningless so we should rename the new table something descriptive. To rename the table simply type over the name in the Table Name: box. When we name a table we must follow a few rules:

I prefer to start all tables with the prefix tbl. In the animated picture (GIF) below is a table I named tblSectors.

Table Sections

When a list is converted to a table, it gains several named sections. Each column is a named region as well as the entire table (#All) , the table's column headings (#Headers), the table's total row (#Totals) and the data existing above the total row and below the header row (#Data). 

Some of the sections can be turned on and off. In the GIF above we can see #HEADERS and #TOTALS being turned on and off by checking the associated options in the Table Style Options group of the Table Design tab.

Named Regions

In this section we will explore the named regions: #Totals, #Headers, #Data, and #All.

#Totals

To get the Total Row, check that box in the Table Design tab > Table Style Options group. When we have a total row, we can refer to it in formulas using the structured reference <TableName>[#Totals]. This table is named tblSectors. So if we want to refer to tblSector's total row we would use the name: tblSectors[#Totals].

We can be even more specific and zero in on the total in Demand B's column using the name: tblSectors[[#Totals],[Demand B]].

In the animated picture above, we can see how we change the total row's function to sum or count a column's numbers. In the drop down we also see several other options. When select any of these options, with the exception of "More Functions...",  Excel inserts a formula using the SUBTOTALS() function. 

SUBTOTALS() has more options than are in that list. For a complete list of options, click: SUBTOTALS(). SUBTOTALS() does something very special. It only performs sums, counts, etc. on visible rows. So if we apply a filter or slicer to a table, SUBTOTAL() ignores hidden rows.

While Excel will default the last column to apply the SUBTOTAL() to, we will find the drop down available on every column in the total row.

#Headers

Every column in the table is named after the column headings in the table's header row. We can refer to the header row in formulas using the structured reference <TableName>[#Headers]. This table is named tblSectors. So if we want to refer to tblSector's header row we would use the name: tblSectors[#Headers].

NOTE! I often use a formula to create an index number for items in a table. That formula references the header row but because the formula cell is in the table, we don't have to spell out the table name when we enter the formula. Here is how I enter the formula to automatically create an index (row number) for each item: =ROW()- ROW([#Headers])

We can be even more specific and zero in on the header in Demand B's column using the name: tblSectors[[#Headers],[Demand B]]. 

Column headings must follow a few rules:

NOTE! While we cannot use formulas as column headings, we can turn off the header row (which will error my automatic index formula) and add formulas above columns. This will have the appearance of normal headings but will not be used as column names. I do not recommend this practice unless you are Peter Bartholomew working on an engineering project.

#Data

If we want all of a table's data (no headers and no total row), we can refer to its #Data name: tblSectors[#Data]. This is identical to referring to just the table's name: tblSectors

#All

If we want the entire table, (headers, data, totals), we can refer to its #All name: tblSectors[#All]

NOTES for future explanation

(Winston Snyder) When selecting a column using Ctrl+Spacebar, the selected column ends where the Table ends.

(Meni Porat) SHIFT+Spacebar selects the current table's row 

(Anup Kumar)


https://www.howtoexcel.org/everything-you-need-to-know-about-excel-tables/

Conclusion

Tables are lists with advantages. In the next section we will learn about table's structure and elements.