View Single Post
  #6   Report Post  
Posted to microsoft.public.word.docmanagement
macropod macropod is offline
external usenet poster
 
Posts: 1,002
Default Text Form Field Calculation

Hi John,

| I tried all three variants. One issue I run into is that the number of
| characters allowed in the calculation field is too few for these formulas.

How so? Word formula fields can handle numbers with up to 15 digits and up to 20 nesting levels (I only had two levels) and a
document can have up to 32,000 fields.

| However, even when I break them up into different text form fields, they
| still don't count the number of fields that are greater than 0. It just
| gives me a blank field.

To get a count of the number of fields *greater than 0*, where the field names are 'Field1' - 'Field10', all you need is:
{=SUM({=Field10},{=Field20},{=Field30},{=Field4 0},{=Field50},{=Field60},{=Field70},{=Field80 },{=Field90},{=Field100})}

Your reference to 'different text form fields' suggests you might be trying to do this using a calculation formfield. DON'T.
Instead, use an ordinary formula field. For example, to create the above:
.. press Alt-F9 to toggle field code display 'on'.
.. select the location where you want the field to go
.. press Ctrl-F9 twice. You see a nested pair of field braces (ie '{ { } }')
.. fill nested pair of field braces in so that you get '{=SUM({=Field10},)}'
.. copy the '{=Field10},' portion of the field and paste it in after the ',' nine times, then delete the final ','. You should now
have a field looking like:
'{=SUM({=Field10},{=Field10},{=Field10},{=Field 10},{=Field10},{=Field10},{=Field10},{=Field1 0},{=Field10},{=Field10},)}'
.. edit the 'Field1' strings so that you get a 'Field1' - 'Field10' sequence, looking like:
{=SUM({=Field10},{=Field20},{=Field30},{=Field4 0},{=Field50},{=Field60},{=Field70},{=Field80 },{=Field90},{=Field100})}
.. press Alt-F9 to toggle field code display 'off'.
.. protect your form
Now fill in the form fields. As you do, you'll see the field you've just created update to give a count of the number of fields
greater than 0.

To get the averages, you'll need to unprotect the document and edit the formula field, by inserting:
'SUM({=Field1},{=Field2},{=Field3},{=Field4},{=Fie ld5},{=Field6},{=Field7},{=Field8},{=Field9},{=Fie ld10})/'
just after the '=' sign.

Cheers

--
macropod
[MVP - Microsoft Word]