text in formula field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to write a formula with text strings as the arguments instead
of numbers?

I am making a form. There is a dropdown box with 2 options: "USD" or "AUD".
I want to set up a formula in a field such that if the dropdown box says
"USD" then the formula field will also return "USD" and vice versa.
 
You can't calculate letters, but you can calculate based on the result of a
form field that contains letters. Use the dropdown field's bookmark in the
calculation. The bookmark will contain the selected content of the field.

Therefore consider a form with two fields Text1 and Dropdown1 and you wish
to multiply Text1 with a figure that relates to the content of Dropdown1.
Insert a Word formula field in the document where you want the result of the
calculation and check the calculate on exit button of both fields (ignore
the any error you get when tabbing out of the first fields if the Text1
field does not yet have content, or set a default value for that field of 0
so that it does)

{ =({ IF{ Dropdown1 } = "AUD" "1" "{ IF{ Dropdown1 } = "USD" "2" }" } *
{Text1 }) }

Here the calculation sets a value of 1 for AUD and 2 for USD. If the value
of AUD and USD are defined elsewhere in the form you can put the form field
names (check their calculate on exit check boxes) in place of the numbers
thus:

{ =({ IF{ Dropdown1 } = "{AUDfieldname}" "1" "{ IF{ Dropdown1 } = "USD"
"{USDfieldname}" }" } * {Text1 }) }

All field boundaries {} are inserted with CTRL+F9. See
http://www.gmayor.com/formatting_word_fields.htm and
http://www.gmayor.com/SelectFile.htm for other examples.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Oops that second example isn't quite right :(
It should have read:
{ =({ IF{ Dropdown1 } = "AUD" "{AUDfieldname}" "{ IF{ Dropdown1 } =
"USD" "{USDfieldname}" }" } * {Text1 }) }

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Dear Anne,

Thank you for the info on cross-referencing... that is very handy. Is it
possible to create a cross-reference to a bookmark? I can't seem to find a
way to do this. I want the reference to change when the dropdown menu is
changed.
 
You can cross reference to any bookmark by using a REF field thus {REF
Bookmarkname} or simply {Bookmarkname} - see the examples I quoted earlier.

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

Back
Top