I think there is a problem in your formula.
Using write cell you can set the value to a valid formula.