Insert a custom column into a table

With Microsoft Power Query for Excel, you can add an Index or Custom (you define the formula) column to your current query. When you create a column formula, Power Query will validate the formula syntax. This validation experience is consistent with how the Advanced Query Editing dialog validates formulas provided by you.

I want to


Insert an Index Column

Using the Query Editor ribbon

  1. In the Query Editor ribbon, click Insert Index Column.

Using the table icon (Table icon ) in the preview grid

  1. Click the table icon (Table icon ).
  2. From the context menu, select Insert Index Column. An Index column is added in the query table. Rename the column name as required.

Top of Page Top of Page

Insert a Custom Column

A custom column is a column where the value in a cell is computed using a formula that you create. For more information about the Power Query Formula Language, see Learn about Power Query formulas.

Using the Query Editor ribbon

  1. In the Query Editor ribbon, click Insert Custom Column.

Using the table icon (Table icon ) in the preview grid

  1. Click the table icon (Table icon ), and click Insert Custom Column.

To insert a custom column

  1. In the Insert Custom Column dialog box, enter a column name, and insert a column into the Custom Column Formula box:
  1. Double click a column from the Available Columns list or
  2. Click a column from the Available Columns list, and click Insert.

 Note    You can use multiple reference columns as long as you separate them with some operator. For example, to calculate a TotalSales column, you add Total and SalesTax using the formula = each [Total] + [SalesTax].

  1. Click OK.

Example formulas

Formula Description

"abc"

Creates a column with the text abc in all rows.

1+1

Creates a column with the result of 1 + 1 (2) in all rows.

[UnitPrice] * [Quantity]

Creates a column with the result of multiplying two table columns.
[UnitPrice] * (1 – [Discount]) * [Quantity] Calculates the total price, considering the Discount column.
"Hello" & [Name] Combines Hello with the contents of the Name column in a new column.

 Note    You can use custom column to merge values from two or more columns into a single custom column. For more information, see Merge columns.

With Power Query, Custom Columns, conditional formatting in Excel, and other customizations of worksheet tables are preserved after you refresh a query. Power Query will preserve worksheet customizations such as Data Bars, Color Scales, Icon Sets or other value-based rules across refresh operations and after query edits.

Custom Columns

Top of Page Top of Page

 
 
Applies to:
Excel 2013, Excel 2010