neileg
AWF VIP
- Local time
- Today, 17:07
- Joined
- Dec 4, 2002
- Messages
- 5,975
Reading a post on here has prompted me to post this.
It baffles me why lots of users chuck in a spurious Sum() in their expressions. One of my colleagues uses this form all the time in Excel, too.
If you write an expression A+B+C this calculates the sum. If you embrace this with Sum(), i.e. Sum(A+B+C) you are summing what is inside the brackets, which has already been evaluated as a single number, since Access (and Excel) start from the innermost calculation.
Now most of the time, this is simply a redundant operation and does not affect the value, but it can in certain circumstances result in an unitended outcome. It is therefore better practice not to do this.
The proper syntax for the Sum() function is of course Sum(A,B,C).
It baffles me why lots of users chuck in a spurious Sum() in their expressions. One of my colleagues uses this form all the time in Excel, too.
If you write an expression A+B+C this calculates the sum. If you embrace this with Sum(), i.e. Sum(A+B+C) you are summing what is inside the brackets, which has already been evaluated as a single number, since Access (and Excel) start from the innermost calculation.
Now most of the time, this is simply a redundant operation and does not affect the value, but it can in certain circumstances result in an unitended outcome. It is therefore better practice not to do this.
The proper syntax for the Sum() function is of course Sum(A,B,C).