The setRange() method only works for lvalues (i.e. object you
can set the value of, such as RooRealVar or generally anything
that inherits from RooAbsRealLValue). Since a RooFormulaVar is
a non-invertible function it is not an lvalue and you cannot do that.
If you send a bit more detail about what you aim to accomplish I might be able to suggest a solution.