Well here's a way. First collect the positions of all `x`: pos = Position[HoldForm[x + 2 + 4 + x], x]; Then: ReplacePart[HoldForm[x + 2 + 4 + x], First[pos] -> 4] > 4 + 2 + 4 + x