Convert formula alpa to numeric in word 2003

D

D Atkins

I am creating an evaluation charge in word. I want people to fill out the
chart just by placing an "X" in the column. Then I want the chart to convert
the "X" to a numeric value and then take an average of all the conversion
numbers. I can get the formula to work in Excel but it will not work in Word.
=IF(B3="X",5,IF(C3="X",4,IF(D3="X",3,IF(E3="X",2,IF(F3="X",1,))))).
Is there a way to write a similar formula that works, have the participants
stay in word, and have the calculation performed?
 
D

Doug Robbins - Word MVP

I assume that you want the value you want to be displayed will appear in
column A. If that is the case, then I would insert a textbox type formfield
in the cells of the first column and a checkbox type formfield in each cell
in the second through the sixth columns of the table and in the formfield
properties dialog for each checkbox type formfield, set a macro containing
the following code to run on exit from the formfield and also check the
Calculate on Exit box for the formfield. When the document is protected for
forms, when the user checks a box in a row, the relevant numeric will appear
in the textbox type formfield in the first column and if you have a formula
to average those values, then it will display the average. If the user
checks one box in a row and then changes their mind, it would be better if
they unchecked that box before checking a different box in that row, but if
they do not, then they will get a message that they have checked more than
one box in the row and both checked boxes will be cleared.

Dim i As Long
Dim j As Long
Dim k As Long
Dim m As Long
Dim box As Range
Dim Flag As Boolean
i = Selection.Information(wdEndOfRangeRowNumber)
Flag = False
m = 0
With ActiveDocument.Tables(1).Rows(i)
For j = 2 To 6
Set box = .Cells(j).Range
If box.FormFields(1).result = 1 Then
If Flag = True Then
MsgBox "You have checked more than one box in this row."
For k = 1 To 6
.Cells(k).Range.FormFields(1).result = 0
Next k
Exit Sub
Else
Flag = True
.Cells(1).Range.FormFields(1).result = 7 - j
End If
Else
For k = 2 To 6
m = m + .Cells(k).Range.FormFields(1).result
Next k
If m = 0 Then
.Cells(1).Range.FormFields(1).result = 0
Flag = False
End If
End If
Next j
End With

You may also want to take a look at 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

--
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
 

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