Calculate Checkboxes to average total

S

Sue Lee

I downloaded the Microsoft Word template "Employee performance review form
(short)" which has checkboxes that rates the employee performance. Can
someone assist in placing a value to each checkbox, then a overall rating
that averages the numbers?
Example the first category has ratings of 1 = Unsatisfactory and the first
row is Job Knowledge and checkbox is clicked 1 = Unsatisfactory. The second
row is Work Quality and the checkbox is clicked 4 = Exceeds Expectations.
After all rows are rated, then an average would calculate in a box.
I am currently using Word 2003.
 
F

Fumei2 via OfficeKB.com

I am not familiar with the template, but a checkbox is boolean, its value is
either True, or False.

In itself, it does not have values like 1, or 4.

That being said, you could build something logically. Although from the
sounds of it, this would get complicated.
 
D

Doug Robbins - Word MVP

If you assign bookmark names of the following form to each of the checkboxes

Checkij

where i is the row number and j is the order of the check box in that row,
such as

Check11, Check12, Check13, Check14, Check15
Check21, Check22, Check23, Check24, Check25
..
..
..
Check61, Check62, Check63, Check64, Check65

and then add a text formfield with the bookmark name of Average to hold the
average, and then set a macro containing the following code to be run on
entry to that formfield, it will be populated with the average of the
checkboxes:

Dim i As Long, k As Long, n As Long
With ActiveDocument
n = 0
For i = 1 To 6
For j = 1 To 5
If .FormFields("check" & i & j).CheckBox.Value = True Then
n = n + j
End If
Next j
Next i
.FormFields("Average").result = n / 6
End With

The form would be enhanced by the inclusion of code to prevent more than one
check box in a row from being checked which can be done by following the
method in the article "Making groups of Check Box Form Fields mutually
exclusive (so that they behave like radio buttons)†at:

http://www.word.mvps.org/FAQs/TblsFldsFms/ExclusiveFmFldChbxs.htm

using the following code in place of that in the article

Sub MakeCheckBoxesExclusive()
Dim oField As FormField
For Each oField In Selection.Rows(1).Range.FormFields
oField.CheckBox.Value = False
Next oField
Selection.FormFields(1).CheckBox.Value = True
End Sub



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top