transcript

excelisfun - Select Multiple Columns from Table with Excel Formula. 6 Examples. Excel Magic Trick 1661

Thumbnail of the video “excelisfun - Select Multiple Columns from Table with Excel Formula. 6 Examples. Excel Magic Trick 1661”
Download Markdown
Community upload. AI output has not been independently verified.

This video shows how to extract multiple columns from a table using an Excel formula, with six examples. The first method uses the INDEX function, which works in any version of Excel. In this example, the goal is to extract the first email and phone columns from a data set. Because the data is an Excel table, the interior of the table is highlighted by pointing to the upper left-hand corner and clicking when the black diagonal arrow appears.

For the row number argument, the formula needs a row counter that increments as the formula is copied down, so the row reference is locked with a dollar sign on the first row while the second reference is left unlocked to create an expandable range that gives the numbers one, two, three, and so on. For the column number argument, the MATCH function is used with the column name and the lookup array. When the field names in the Excel table are highlighted, the table formula nomenclature appears for the column header names. Exact match is used by entering zero as the match type, and MATCH reports the relative position of the field name as two.

The lookup value must be locked when copying down, but it must move to the next field name when copied to the side, so the F4 key is pressed twice to set the correct reference. After closing the parenthesis, the formula is entered with Control and Enter, copied down, and then copied to the side. Pressing F2 in the last cell confirms that all cell references are working, and three columns have been extracted. This formula works in any version of Excel.

If Office 365 is available, a dynamic array formula can be used instead. The first Office 365 method spills each column individually. The row number argument is left empty, which returns all rows when extracting a single column, and the column number argument uses XMATCH, whose default is exact match. Because the formula spills the whole column, the field name does not need to be locked. After pressing Control and Enter, the formula spills the full table. The top cell is copied to the side, and the last cell is checked with F2. Formulas in the spilled cells below appear grayed out because they are not stored there; they are only spilled results.

The second Office 365 method spills both rows and columns from a single cell. The row number argument is filled with a SEQUENCE function that counts the rows of the employee table, using the first column, ID, as the reference. The default number of rows is one, and the step is one. Pressing F9 shows the array 1 through 10, which is the set of row numbers needed. The column numbers come from XMATCH applied to an array of three field names: Employee, #, and Headers. Because the default is exact match, MATCH returns the three relative positions of these field names simultaneously, which are 2, 5, and 6. Pressing Enter delivers all 10 rows and columns 2, 5, and 6. Changing the field names updates the extracted columns.

A bonus formula is also shown on a new sheet. Typing the table name followed by a square bracket and the field names, then using the spill operator with the pound symbol, spills the field names horizontally. Simply typing the table name and pressing Enter grabs the whole table, and it is fully dynamic, so inserting a column or adding a row in the source table updates the result. Another bonus formula combines these steps into one, using the table name, square brackets, and the pound symbol for all items to get both the field names and the full table.

A practical tip addresses why someone might use a formula that returns only one column at a time instead of the whole table. If the goal is to access individual columns, referring to the whole table works for lookup tables, but if a particular column must be accessed, the spill operator will not work from a formula that only lives in the upper left corner. In that case, the old-fashioned method is needed. When a single column is accessed directly, because the formula actually lives in that cell, the pound symbol and closing parenthesis can be used, and pressing Enter spills the result.