Microsoft Office Forums Total Checked FF Check Boxes

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-12-2016, 08:56 AM
CarlCR CarlCR is offline Total Checked FF Check Boxes Windows 10 Total Checked FF Check Boxes Office 2007
Novice
Total Checked FF Check Boxes
 
Join Date: Jul 2016
Posts: 4
CarlCR is on a distinguished road
Cool Total Checked FF Check Boxes

I have a table in Word 2007 and 2013 with several columns that have FF Check Boxes in them. I would like to total the number of boxes that are checked. I've tried the following, but they don't work: =COUNTIF(A3:A13,TRUE), =Sum(A3:A13,TRUE).



Could someone please give me a formula that will total the checked boxes?
Reply With Quote
  #2  
Old 07-12-2016, 08:53 PM
gmayor's Avatar
gmayor gmayor is offline Total Checked FF Check Boxes Windows 10 Total Checked FF Check Boxes Office 2016
Expert
 
Join Date: Aug 2014
Posts: 3,025
gmayor is just really nicegmayor is just really nicegmayor is just really nicegmayor is just really nicegmayor is just really nice
Default

Word is not Excel, so you won't be able to do this with Excel functions.

You will need a macro. As you already propose using a macro to colour the fields then you could use a macro to calculate the column count.

The only proviso is that there must not be split or merged cells in the table or the code will not work.

No doubt you can call this macro from the other macro to update the count on exit from each field. The macro will count the checked boxes in each column and add the total to the last row of that column.

Code:
Sub CountCheckBoxes()
Dim oTable As Table
Dim oCell As Cell
Dim oFF As FormField
Dim iCount As Long, iField As Long
Dim oCol As Column
Dim bProtected As Boolean
    'Unprotect the file
    If Not ActiveDocument.ProtectionType = wdNoProtection Then
        bProtected = True
        ActiveDocument.Unprotect Password:=""
    End If
    Set oTable = ActiveDocument.Tables(1)
    For Each oCol In oTable.Columns
        iCount = 0
        iField = 0
        For Each oCell In oCol.Cells
            For Each oFF In oCell.Range.FormFields
                If oFF.Type = wdFieldFormCheckBox Then iField = iField + 1
                If oFF.CheckBox.Value = True Then iCount = iCount + 1
            Next oFF
        Next oCell
        If iField > 0 Then oCol.Cells(oTable.Rows.Count).Range.Text = CStr(iCount)
    Next oCol
    If bProtected = True Then
        ActiveDocument.Protect _
                Type:=wdAllowOnlyFormFields, _
                NoReset:=True, _
                Password:=""
    End If
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 07-13-2016, 12:01 PM
CarlCR CarlCR is offline Total Checked FF Check Boxes Windows 10 Total Checked FF Check Boxes Office 2007
Novice
Total Checked FF Check Boxes
 
Join Date: Jul 2016
Posts: 4
CarlCR is on a distinguished road
Default

Thanks again gmayor.
Reply With Quote
Reply

Tags
check box, countif, table

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Total Checked FF Check Boxes How to make a Check Box Form Field red if not checked? CarlCR Word Tables 3 07-12-2016 08:35 PM
Check Box Content Control when checked users are presented with an option cryder Word 0 01-07-2016 05:11 AM
Total Checked FF Check Boxes Check box form field automatically checked Eduardo Care Word 8 09-07-2015 03:31 PM
how to show total of check boxes checked worder Word 16 03-10-2014 05:07 PM
Total Checked FF Check Boxes Repeat Spell check in a doc that has already been checked mawigfie Word 1 08-22-2012 01:16 PM


All times are GMT -7. The time now is 03:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft