Power Query: How to Retrieve Excel Defined Name Values
In this guide, we will walk through the process of defining a named value in Excel and creating a reusable Power Query function to retrieve that value. This will allow you to easily reference specific data from your Excel workbook and use it in queries for tasks like filtering or analysis.
Instructions
Step 1: Define a Named Value in Excel
- Select the cell containing the value you want to name in Excel.
- From the
Formulasribbon, clickName Manager. - In the
Name Managerdialog box, click theNewbutton. - In the
New Namedialog box:
- In the
Namefield, enter a name for the cell (e.g.,REF_NAMED_RANGE_VALUE). - In the
Refers tofield, confirm or select the cell with the reference data.

- Click the
OKbutton. The new name will appear in theName Manager.

- Click the
Closebutton.
Now, when you select the cell in Excel, the defined name will appear in the Name Box next to the Formula Bar.

Step 2: Create a New Power Query Function
- From the
Homeribbon in Power Query, selectNew Source>Other Sources>Blank Query. This creates a new blank query. - From the
Homeribbon, clickAdvanced Editor. - Replace the default query with the following function:
let
GetDefinedNameValue = (definedName) =>
let
name = Excel.CurrentWorkbook(){[Name = definedName]}[Content],
value = name{0}[Column1]
in
value
in
GetDefinedNameValue
- Click the
Donebutton. - In the
Query Settingspane, underProperties, rename the query toGetDefinedNameValue. - Click
Close & Loadto exit Power Query.
Results
To test the function:
- From the
Queriespane in Power Query, selectGetDefinedNameValue. - A prompt will appear asking for a parameter. For
definedName, enterREF_NAMED_RANGE_VALUE. The function call will look like this:
= GetDefinedNameValue("REF_NAMED_RANGE_VALUE")

- Click the
Invokebutton. - The result of the function will appear as a new query named
Invoked Functionin theQueriespane, returning the valueTEST PROJECTas expected.

This function can now be used to easily pull specific reference values from an Excel workbook into other queries for filtering or other tasks.
Summary
You’ve learned how to define named values in Excel and create a reusable Power Query function to access them. This process makes it easier to pull specific reference values into other queries without modifying the underlying queries when the reference data changes. These steps will improve the efficiency and consistency of your data analysis.