This would be easier to respond to if we had some example code. While I would definitely suggest using Piecewise over Which or If, it is unclear whether this is the primary issue you are running into.