View Single Post
  #3   Report Post  
Posted to microsoft.public.word.tables
Linda Aldrich Linda Aldrich is offline
external usenet poster
 
Posts: 6
Default Average Calculation in a Protected Form - Word 2003

Thank you, Doug for the response. However, when I try to run that macro on
entry of the 'Total' cell, I get an error message: "The collection that
your expression refers to does not exist".

"Doug Robbins - Word MVP" wrote in message
...
You are probably going to have to use a macro

Dim i as Long, j as Long
i = 0
j = 0
With ActiveDocument
If .Formfields("intPMBPD1").Result 0 then
i = i + 1
j = j + .Formfields("intPMBPD1").Result
End If
If .Formfields("intPMBPD1").Result 0 then
i = i + 1
j = j + .Formfields("intPMBPD2").Result
End If
If .Formfields("intPMBPD2").Result 0 then
i = i + 1
j = j + .Formfields("intPMBPD3").Result
End If
If .Formfields("intPMBPD3").Result 0 then
i = i + 1
j = j + .Formfields("intPMBPD4").Result
End If
If .Formfields("intPMBPD4").Result 0 then
i = i + 1
j = j + .Formfields("intPMBPD5").Result
End If
If .Formfields("intPMBPD5").Result 0 then
i = i + 1
j = j + .Formfields("intPMBPD5").Result
End If
If .Formfields("intPMBPD6").Result 0 then
i = i + 1
j = j + .Formfields("intPMBPD6").Result
End If
If .Formfields("intPMBPD7").Result 0 then
i = i + 1
j = j + .Formfields("intPMBPD7").Result
End If
.Formfields("bookmarknameforaverage").Result = j/i
End With


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

"Linda Aldrich" wrote in message
...
Hi,

I have used the calcuation expression within a table form field, using
the bookmarks for each of the fields. If the fields have a '0' value
they get averaged into the final figure. How do I dis-include the '0'
values from the average? Below is the expression for the Form Field
"intAverPMBPD":

=AVERAGE(intPMBPD1,intPMBPD2,intPMBPD3,intPMBPD4,i ntPMBPD5,intPMBPD6,intPMBPD7)

Thank you for any help you can provide!

Linda