I have implemented something like this before (formulas a little more complicated). If you are using table and field names in your formulas, the most important thing is to avoid the user having to type them in. Indeed they shouldn't be aware of the underlying data storage at all.
My solution was to provide draggable elements that wrapped the table / field names from the data base and displayed a user friendly label. It is nicer for the user not to see the "technical" names.
The formula itself was built up from pairs of elements seperated by an operator (clicking on the operator gives a menu to change it), and the user can drag a formula onto any of the elements (except for the operator) to build something more complicated (like in the screenshot). Nested elements automatically have brackets rendered around them.
The only typing the user can do is clicking on the text box to enter numeric values, so the validation is very easy (no formula parsing required).
I also had other formula types (e.g. max and min like you have in excel).
I implemented this in Winforms quite some years ago, and I had to do all the rendering and handling the mouse pointer / drag drop position myself. Definitely much easier to do it in Jquery / HTML5.