Format text field as number with +/-

  • Thread starter Horatio J. Bilge, Jr.
  • Start date
H

Horatio J. Bilge, Jr.

I am using Word 2007. I inserted a text form field, using the legacy forms
controls. Under properties for that field, I formatted it as Type: Number,
and Number Format: 0.0

I want the field to display the number with the +/- sign (e.g., if I enter
"1.5" it displays as "+1.5", and if I enter "-1.5" it displays as "-1.5").
Zero should be displayed as "0.0"

I found information about using switches on Graham Mayor's site, but I
couldn't get the switch to work as expected. This is what I tried: { FORMTEXT
\# +0.0 }

Thanks for any help,
~ Horatio
 
G

Graham Mayor

The simplest method is to add a Word field immediately before the form field
e.g if the form field is Text1
{ IF{ REF Text1 } > 0 "+" }
Check the calculate on exit check box of the form field.and set the number
format property to 0.0

If you enter 0 you will see 0.0. If you enter 1 the Word fielf will display
+ in front of 1.0. If you enter -1 the formfield will display -1.0

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
H

Horatio J. Bilge, Jr.

Thank you for the advice. After playing with it and reading some more, I
added a "result if false" to your suggestion:
{ IF{ REF Text1 } > 0 "+" " " }
With that adjustment, if I change the value in Text1, the +/- sign updates
to match.

Thanks for the help!
~ Horatio
 
G

Graham Mayor

There should be no need to add a 'result if false' option if the result if
false is nothing. The field will default to nothing if the condition is not
met.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.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