View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
John John is offline
external usenet poster
 
Posts: 307
Default If "Yes" then "Yes or round as percentage

Graham - Thanks for the response. Without a switch, the field returns a
non-rounded number when the source is populated with a number and 'N/A' or
null when the field is populated with 'N/A' or null respectively. I will
read through your website below and try your suggested switch then let you
know how it came out.
Thanks again.



qwerty


"Graham Mayor" wrote:

What does the field produce without a switch for each condition?

The Yes, No and possibly the null should reproduce what you have in the
field. The only one that seems likely to cause trouble is the percentage
field. That being the case, on the face of it you need a nest of conditional
fields that test each possible result ie

{ IF{ MERGEFIELD Target } = "Y*" "{ MERGEFIELD Target }"} (Look for words
beginning upper case Y i.e. YES or Yes)
{ IF{ MERGEFIELD Target } = "N*" "{ MERGEFIELD Target }"}(Look for words
beginning upper case N i.e. NO or No)
{ IF{ MERGEFIELD Target } = "" "" } (Look for Null)
{ IF{ MERGEFIELD Target } = "Anything else" "{ ={ MERGEFIELD Target} * 100
\# "0.0%"}" }

so that would give you:

{ IF{ MERGEFIELD Target } = "Y*" "{ MERGEFIELD Target }" "{ IF{ MERGEFIELD
Target } = "N*" "{ MERGEFIELD Target }" "{ IF{ MERGEFIELD Target } = "" ""
"{ ={ MERGEFIELD Target} * 100 \# "0.0%"}" }" }" }

Each pair of field brackets is inserted with CTRL+F9.

Switches are covered at http://www.gmayor.com/formatting_word_fields.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





John wrote:
I am trying to import data from Excel into a Word document via mail
merge. All data in Excel is derived via a formula. One field
Target is giving me trouble because is may be a percentage
e.g.98.5%, a Yes/No. or Null. I have tried If Then and nothing seems
to work to get the results I need.

If the value is Yes, then I need it to state Yes, If it is a
percentage, I need it to format as a percent and round to the 1st
decimal. If it is null, I need it to state "N/A"


Incidentally, I do not understand the merge switch concept and why it
seems to toggle between three states, then two. Resources for this
would be appreciated as well.

Thanks