Calculating IF Field in Word

J

Jerry

I have a table in a Word "Form" 2000 document that I am
attempting to use an IF statement to return numeric values
for specific text entries from one cell to another. The
user will enter one of the following:

Very High
High
Medium
Low

The corresponding return in another cell within the same
table should return 20 for Very High, 10 for High, 5 for
Medium, and 1 for Low.

The following expression works in Excel, but I cannot seem
to get it transposed to work with word's field braces;
where risk1 = the bookmark name:

IF(risk1="Very High",20,(IF(risk1="High",10,(IF
(risk1="Medium",4,(IF(risk1="Low",1,(IF
(risk1="N/A",0)))))))))

Any help provided is appreciated...
Jerry
 
D

Doug Robbins - Word MVP

In Word, you do no use commas a separators in an IF field construction and
you must use Ctrl+F9 to insert each pair of field delimiters. The following
field construction will do what you want

{ IF risk1 = "Very High" 20 { IF risk1 = "High" 10 { IF risk1 = "Medium" 4
{ IF risk1 = "Low" 1 0 } } } }

Assuming howeverthat risk1 is actually a formfield, it can also be done by
running a macro on exit from that field. The following assumes that the
result is to be placed in a formfield to which the bookmark name "score" has
been assigned:

Dim risk As String, score As Long
risk = ActiveDocument.FormFields("risk1").Result
Select Case risk
Case "Very High"
score = 20
Case "High"
score = 10
Case "Medium"
score = 4
Case "Low"
score = 1
Case Else
score = 0
End Select
ActiveDocument.FormFields("score").Result = score



--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
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