Results 1 to 6 of 6
  1. #1
    rosscortb is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    52

    Calculated Field

    Hello,



    If I have 4 fields, A,B,C,D

    and in column 5 I have a calculated field adding the total of the 4 columns, [A]+[B]+[C]+[D], works fine, but if there is no cost in say column C, it woudn't add so do I need an if statement, not sure on this. Dummy's guide would be appreciated.

    Thanks

    Ross

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Use the NZ function to handle null values, i.e.
    Code:
    NZ([A],0)+NZ([B],0)+NZ([C],0)+NZ([D],0)
    See this for more on the NZ function: http://www.techonthenet.com/access/f...dvanced/nz.php

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Note: having/using calculated fields in a table is not a good idea. Since it is calculated, it can be calculated at any time.

    Read this page carefully. Read it at least twice, especially the last two paragraphs.
    http://allenbrowne.com/casu-14.html
    Last edited by ssanfu; 11-24-2014 at 12:09 PM. Reason: shouold have added the link :(

  4. #4
    theyad75 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    13
    make new query design add all the column of the table then in next column write total:NZ([A],0)+NZ([B],0)+NZ([C],0)+NZ([D],0)

    if u want another column for classifcations result tell me
    Click image for larger version. 

Name:	askme.jpg 
Views:	21 
Size:	47.9 KB 
ID:	18833

  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    My original reply was geared towards a Query solution, like theyad75 shows how to implement my solution in a query. I don't know if you were trying to do the calculation in a table, but if so, I wholeheartedly agree with Steve.

  6. #6
    theyad75 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    13
    Yes for Sure JoeM your Answer is the core part of the solution

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-25-2014, 01:23 PM
  2. Replies: 4
    Last Post: 03-20-2014, 03:52 PM
  3. Replies: 2
    Last Post: 12-15-2013, 02:29 AM
  4. Replies: 1
    Last Post: 04-21-2013, 03:20 PM
  5. Replies: 3
    Last Post: 02-13-2013, 10:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums