A product renamed from Old Name to New Name will sit in the data under both names until every old value is replaced, and a total by product will split in two. Power Query Replace Values swaps the old value for the new one across the whole column, and the step can be re-run when the data refreshes.
Prerequisites
- Excel with Power Query
- A table with values to replace
- A copy of the source file, so the original stays untouched.
Steps
- Select the table and go to Data, From Table/Range to open it in the Power Query Editor.
- Select the column, then go to Transform, Replace Values.
- Type the old value and the new value exactly, and choose whether the whole cell must match.
- Check the row count and the distinct values in the column before and after the replacement.
- Click Close and Load, then filter the column for the old value and confirm it is gone.
Worked example: Fictional product rename replacement
The practice table below is a fictional five-sale list after replacing Old Blend with New Blend. The amount column is the sale value, and the total is their sum. The table below is fictional practice material, with fictional values. It is the expected result, worked out by hand, not a run of any tool.
| Product | Amount |
|---|---|
| New Blend | 12.50 |
| New Blend | 18.75 |
| Dark Roast | 9.99 |
| Dark Roast | 14.25 |
| New Blend | 21.00 |
| Total | 76.49 |
Expected result. Three sales under New Blend, none under the old name, and the amounts add to 76.49.
Limits
- Replace Values without whole-cell matching can change text inside other values, so check the setting.
- A replacement in Power Query does not change the source data, so the source still holds the old value.
