Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating sums of values

Status
Not open for further replies.

rachelellen

Technical User
May 22, 2000
2
GB
I'm sure this should be simple, but I'm having trouble calculating the sum of a number of values within a table.<br><br>How do I get the sum of 6 different fields within a record in a table, the sum then becoming an additional field?<br><br>Many thanks.<br><br>Rachel.
 
in a query that contains the fields in question put this in the &quot;Field&quot; row of a blank column:<br><b>Total: [Field1]+[Field2]+[Field3]+[Field4]+[Field5]+[Field6]</b><br><br>obviously substituting your field names for where it says Field1, Field2, etc... <br>but leave the brackets. <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Yup<br><br>That's what I've tried before. For some reason this is only working for roughly 50-60% of the entries.<br><br>Can anyone come up with a possible reason for this?<br><br>Rachel.
 
Sounds like some of your fields may have NULL values.&nbsp;&nbsp;When you create any formula which refers to a NULL value, you receive a NULL in return.<br><br>Try using the &quot;Null to Zero&quot; function...<br><br>Total: Nz([Field1])+Nz([Field2])+Nz([Field3])+Nz([Field4])+Nz([Field5])+Nz([Field6])<br>&nbsp; <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
 
Drop this in a query.<br><b>&quot;SELECT SUM(field+field2+field3+field_n) as itemTotal&quot;</b><br><br> <p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top