I think I've come up with the solution for both of these problems.
Most programmers would (correctly) put the code before the "return $result;". I say "most", because I'm a programmer, but I still screwed this up today. Most non-programmers would think that "append" means "append", and put it either right before or right after the ?> (I incorrectly put it right before, knowing that it needed the end tag).
If you paste the code right before the return line, AND you change the version in this file and in version.php, and you visit the Admin page, you'll get several complaints about recreating the database. But it will work! No more ERROR and no more new Total column everytime you go to the Admin page.
Also, being a dorky programmer, I wanted to be able to use the modulus operator in my formulas. Here is the line I changed to allow %.
// Sum may contain the following characters:
$check = strtr($check, '0123456789+-*/%(),:N', " ");
I added a % within the single quotes, and an extra space within the double quotes.