Modify a formula

All query transformations in Microsoft Power Query for Excel are performed by formulas. As you use the query editor builders, a formula is added to the formula bar. At times you may want to add a formula other than those associated with a builder, or you may want to alter an existing formula.

I want to

Show or hide the formula bar

Add formula to a query

Edit a formula

Edit a formula using the formula’s dialog box

Edit a formula in the formula bar

Show or hide the formula bar

  1. In the query editor, click Settings > Show Formula Bar or Hide Formula Bar.

Add formula to a query

You can find information on Power Query formulas at the Learn about Power Query formulas topic. When you create a 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.

Note    When you insert or delete an intermediate step in a query you might potentially break a query. Power Query will display an Insert Step warning when you try to insert a new step.

To add a formula to a query

  1. In the query step pane, select the step you want to immediately precede the new step (formula).

  2. Click the fx icon to the left of the formula bar. A new formula is created in the form = <nameOfTheStepToReference>. For example, = Production.WorkOrder.

  3. Type in the new formula using the format = Class.Function(ReferenceStep[,otherparameters]).
    For example, assume you have a table with the column Gender and you want to add a column with the value “Ms.” or “Mr.”, depending on the person’s gender. The formula would be = Table.AddColumn(<ReferencedStep>, "Prefix", each if [Gender] = "F" then "Ms." else "Mr.")

Example formula

Top of Page

Edit a formula

There are two ways to edit a formula: using the formula’s dialog box and using the formula bar.

Edit a formula using the formula’s dialog box

  1. In the query step pane, right-click the step you want to edit.

  2. From the context menu select Edit Settings.

  3. In the dialog box, edit the formula.

Edit a formula in the formula bar

  1. In the query step pane, select the step you want to edit.

  2. In the formula bar, locate and change the parameter values to the values you want.

  3. Click Refresh.

Top of Page

Applies To: Excel 2013, Excel 2010



Was this information helpful?

Yes No

How can we improve it?

255 characters remaining

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!

Support resources

Change language