Change One Value in a Filtered Power Query Row in Excel
Question details
Change a value in one identified Power Query row without replacing every matching value in the column.

- Product
- Microsoft Excel Power Query
- Device & OS
- not provided
- Scenario
- A user wants to replace a null cost for a specific product in a filtered query.
- Observed behavior
- Replace Values changes every matching null in the selected column rather than only the intended record.
Identify a column or combination of columns that uniquely identifies the target row. Check the target column's data type and decide what value should replace the null.
Use a conditional custom column to update the target row
Use this method to replace a null only when the row also meets your identifying criteria.
The condition applies to every row that matches it, so add more criteria if the product name alone is not unique.
In Excel, go to Data > Queries & Connections, then open the query in Power Query Editor.
In Power Query Editor, select Add Column > Custom Column and name it Corrected Cost.
In the formula box, enter: if [Product] = "x" and [Cost] = null then 15 else [Cost]. Replace x, 15, and the column names with your actual product, replacement value, and columns.
Select OK and inspect the Corrected Cost column. If more than one row changes, edit the custom column step and add another condition that uniquely identifies the target record.
Set Corrected Cost to the appropriate data type. If it should replace Cost, remove the original Cost column, rename Corrected Cost to Cost, and select Home > Close & Load.

Edit spreadsheet values with WPS Office
For direct spreadsheet editing, WPS Office is a free, lightweight alternative with a familiar interface and support for Microsoft Office formats. Open an existing workbook and edit cells without starting over; WPS does not fix or replace Excel Power Query transformations.

Frequently Asked Questions
Why did Replace Values change more than one row?
Replace Values acts on matching values in the selected column at that query step. Use Add Column > Custom Column with conditions that identify the intended record as well as the value to replace.
What if several rows have the same product name?
Add another identifying condition to the custom column formula, such as and [OrderID] = 123, using a column and value that distinguish the target row.
Will the conditional replacement apply after a refresh?
Yes. The custom column is a query step, so Power Query evaluates the condition again when you refresh. Any rows matching the condition at that time will receive the replacement.
Can I keep both the original and corrected values?
Yes. Leave the original Cost column in place and keep the new column under a different name, such as Corrected Cost, before selecting Home > Close & Load.




