BTW, you might build the whole formula as a string and see if it's correct. Your first Replace is going to replace two instances, and the second will replace none.