+ Reply to Thread
Results 1 to 18 of 18

Totaling the Number of Checked Boxes

  1. #1
    Registered User
    Join Date
    01-09-2015
    Location
    Orangeville, Canada
    MS-Off Ver
    2007
    Posts
    6

    Totaling the Number of Checked Boxes

    Hi there,

    I have created a list of criteria for my students and then added check boxes. I want to automatically total how many students have followed each one. I have seen replies based on having a value in the column beside the box, but I just want to total the number of checks in each row. Any suggestions?

    Thanks,

    Sean
    Attached Images Attached Images

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Totaling the Number of Checked Boxes

    Well, all check boxes have a linked cell to which they output values like TRUE and FALSE. Use COUNTIF function to count.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Registered User
    Join Date
    01-09-2015
    Location
    Orangeville, Canada
    MS-Off Ver
    2007
    Posts
    6

    Re: Totaling the Number of Checked Boxes

    Thanks for the quick reply. You may have to walk me through this if possible.

    Thanks again

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Totaling the Number of Checked Boxes

    I can't do this without seeing the workbook. Do you know the range of the linked cells?

  5. #5
    Registered User
    Join Date
    01-09-2015
    Location
    Orangeville, Canada
    MS-Off Ver
    2007
    Posts
    6

    Re: Totaling the Number of Checked Boxes

    B2 to AB2 is one of the rows

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Totaling the Number of Checked Boxes

    Try this formula

    =COUNTIF(B2:AB2,"TRUE")

    this will count all true when checked provided that that check boxes were set up to show "TRUE" when checked and "FALSE" if not.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Totaling the Number of Checked Boxes

    Quote Originally Posted by AlKey View Post
    Well, all check boxes have a linked cell to which they output values like TRUE and FALSE.
    You have to set the linked cell. It doesn't happen automatically.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Totaling the Number of Checked Boxes

    Quote Originally Posted by Tony Valko View Post
    You have to set the linked cell. It doesn't happen automatically.
    That is unknown

  9. #9
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Totaling the Number of Checked Boxes

    Hello
    Just follow these steps
    1. Press Alt F11
    2. Visual Basic Window will appear....Click insert>>>Module>>and paste the following code

    Sub LinkCheckBoxes()
    Dim chk As CheckBox
    Dim lCol As Long
    lCol = 25 'number of columns to the right for link

    For Each chk In ActiveSheet.CheckBoxes
    With chk
    .LinkedCell = _
    .TopLeftCell.Offset(0, lCol).Address
    End With
    Next chk

    End Sub

    3. Now press F5 to run this code....This code automatically assigns a cell link for each checkbox in the columns AA:AZ...now close this window and in your spreadsheet see columns AA:AZ they will show true or false depending upon the respective checkbox....

    4. Now paste this formula in the column where you want the results and copy it downwards ..

    =COUNTIF(AA2:AZ2,TRUE)

    It will give you the result for each row

    Hope it helps
    Ask for further doubts

    Regards
    Sourabh Gupta

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Totaling the Number of Checked Boxes

    Quote Originally Posted by AlKey View Post
    That is unknown
    It's unknown if the OP has set linked cells.

    My reply was to inform them that the linked cell doesn't just happen automatically. You have set the linked cell a certain way depending on what type of checkbox you're using.

    Judging from the screencap, it looks like the checkboxes are ActiveX checkboxes.

    To set an ActiveX checkbox goto the Developer tab>click the Design Mode button. Right click on a checkbox>select Properties>select LinkedCell>enter the desired cell address for the linked cell

    Close the Properties userform
    Goto the Developer tab>Click on the Design Mode button to exit design mode.

  11. #11
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Totaling the Number of Checked Boxes

    If you like my answer then please encourage me by pressing add reputation below * thanks.....

  12. #12
    Registered User
    Join Date
    01-09-2015
    Location
    Orangeville, Canada
    MS-Off Ver
    2007
    Posts
    6

    Re: Totaling the Number of Checked Boxes

    sourabhg98

    Here is the file that you requested. Thanks. Once I see what you have done, I may be able to study it to see how it was fixed.

  13. #13
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Totaling the Number of Checked Boxes

    Heres the workbook
    I think that was my mistake....it should have been 28 in the formula instead of 25
    Sorryyy......
    I have done the changes and removed the macro as it is of no use now....it was only to create links

  14. #14
    Registered User
    Join Date
    01-09-2015
    Location
    Orangeville, Canada
    MS-Off Ver
    2007
    Posts
    6

    Re: Totaling the Number of Checked Boxes

    Thanks for looking at this. It is not totaling the checks in each row and then adds the word TOTAL in cells further to the right of the spreadsheet. I have attached a model of what I am trying to get it to look like.

  15. #15
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Totaling the Number of Checked Boxes

    First you need to make small change to the VBA code: replace 25 with 0 in the line below, close module and re-run script by pressing F5 This will assign linked cells from B2 to AB2 for all check boxes. After that you can make them invisible in the cell by formatting all cells behind check boxes as Custom, and type in ;;;

    lCol = 25 'number of columns to the right for link

    now in cell AC2 you can use formula

    =COUNTIF(B2:AB2,TRUE)

    Please see attache file

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Totaling the Number of Checked Boxes

    Another option is to just enter an X in the cells. You could either type them in manually or use an event macro to just double click on the cell, or simply by selecting a cell and the X will be entered automatically.

    Then you'd count the number of Xs in the range.

    =COUNTIF(Range,"X")

  17. #17
    Registered User
    Join Date
    01-09-2015
    Location
    Orangeville, Canada
    MS-Off Ver
    2007
    Posts
    6

    Re: Totaling the Number of Checked Boxes

    Thanks so much everyone. I really appreciate your time and patience.

    Sean

  18. #18
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Totaling the Number of Checked Boxes

    You're welcome and thank you for the feedback!

    Please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools -> Mark thread as Solved).

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need to Count number of Check Boxes checked on a userform
    By UMBiii in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-12-2014, 03:44 PM
  2. [SOLVED] How to Count Check Boxes and count the total number of boxes checked
    By t04904 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2013, 11:45 AM
  3. Count number of checked boxes
    By Motox502 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-02-2012, 03:11 PM
  4. Number of check boxes checked
    By mraheelgujjar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2011, 08:32 AM
  5. I want to be able to count the number of checked boxes in a form?
    By cldavis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-21-2005, 05:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1