Results 1 to 8 of 8
  1. #1
    CPWachs is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2021
    Posts
    4

    Counting Multiple Columns in Reports

    Good day everyone.


    Trying to calculate the sums of three columns in a report. In the report, i used the Total "x" function for each of my columns, but when I try to use =Count([X1]+[X2]+[X3]) it just returns a zero. I even tried changing field to =Count([AccessTotalsX1]+......... . Any help would be appreciated. Thank you and happy holidays!

  2. #2
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    980
    You want to COUNT the columns? (We should probably refer to columns as fields) Do you mean add them up? You want something like sum_of_x1 + sum_of_x2 + sum_of_x3 ? That would just be =SUM([field1]+[field2]+[field3])

  3. #3
    CPWachs is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2021
    Posts
    4
    I have tried that one as well. It returns a zero as well.

  4. #4
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    980
    Quote Originally Posted by CPWachs View Post
    I have tried that one as well. It returns a zero as well.
    Maybe try this:
    Code:
    =Sum(Nz([Field1])+Nz([Field2])+Nz([Field3]))
    I'm guessing here. You're going to have to help us help you. "doesn't work" isn't much for us to go on. If the above doesn't work attach a zipped copy of your db as well as an explicit description of exactly what it is you're trying to achieve.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    51,017
    What exactly is "Total 'x' function"? What do you mean by title "Count Multiple Columns"? What exactly do you expect =Count([X1]+[X2]+[X3]) to return?

    Show some sample data and desired output or provide db for analysis.

    Cannot reference control names in aggregate functions, must be fields.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    CPWachs is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2021
    Posts
    4
    Click image for larger version. 

Name:	20211228_055815.jpg 
Views:	12 
Size:	195.1 KB 
ID:	46942
    Apologies for the late replies and thank you for the quick responses. Attached is picture of what I'm working with. Trying to make an Attendance Report. I can get the total of each individual column such as DX, NX, MX, etc, but I can't get it to add the three together to make 26. In the picture, I used =Count([AccessTotalsDX]+[AccessTotalsNX]+[AcessTotalsMX]) which does return 26, but when I open the Report it asks for the parameter value. If I enter 1, it returns 26. Hopefully this helps and thank you again.

  7. #7
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    2,217
    I think you simply need

    = [AccessTotalsDX]+[AccessTotalsNX]+[AcessTotalsMX]

    Assuming those are already Sum() style controls in the form or report footer.

    If not you may need to repeat the calculation individually

    = Sum(DX) + Sum(NX) + Sum(MX)
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  8. #8
    CPWachs is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2021
    Posts
    4
    @Minty.
    =([AccessTotalsDX]+[AccessTotalsNX]+[AcessTotalsMX]) did the trick! Thank you so much!

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

Similar Threads

  1. Counting in Reports
    By Shue6842 in forum Reports
    Replies: 3
    Last Post: 07-02-2019, 08:35 AM
  2. Replies: 4
    Last Post: 03-25-2019, 10:46 AM
  3. Counting groups in reports bug
    By anthgav in forum Reports
    Replies: 4
    Last Post: 07-31-2018, 11:12 AM
  4. Counting Columns in a Query
    By bellevue in forum Queries
    Replies: 2
    Last Post: 01-23-2013, 10:38 AM
  5. counting ticks in reports
    By rumplstilskin in forum Reports
    Replies: 2
    Last Post: 05-03-2012, 10:23 AM

Tags for this Thread

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