Forum Discussion

Confusedsigh's avatar
Confusedsigh
New Member
3 years ago
Solved

How do I replace the value in just one cell, please?

I want to replace the value Null to a certain number - in one cell. The problem is when I click on Replace Value, it will replace ...all... the Null values in that column with this number. How can...
  • ImkeF's avatar
    3 years ago

    Hi Confusedsigh ,
    if the criteria that determines which row your value to be replaced sits in is called "Column3" and the condition is that the value is equal to 1 and you want to replace values in "Column2", then you could use this syntax:

    = Table.ReplaceValue(#"Changed Type", null, each if [Column3] = 1 then "x" else [Column2], Replacer.ReplaceValue,{"Column2"})

    Just do a full replace with the UI and then tweak the red part of the formula.
    For more information around this technique, please check my article here: Table.TransformColumns - alternative in PowerBI and PowerQuery in Excel (thebiccountant.com)

  • ImkeF's avatar
    3 years ago

    Hi Confusedsigh ,
    no, that is what the condition is doing:
    each if [Column3] = 1 then "x" else [Column2]
    it will only replace the null values in Column2 if in another column ("Column3") the condition is met.
    How are you going to determine which is the null value to be replaced in your case?