In Word I am trying to format a number created from a formula,
examples below:
If 40.00 want to display no decimals so just 40
If 37.50 want to display just 37.5
If 37.75 want to display just 37.75
How do you do this. This looks a fairly easy task and I am probably
being completely stupid, but I cannot find out how to do this with
switches.
{ =({MERGEFIELD} + 0) \# "0.00" }
This adds 2 decimals no matter what.
Any ideas.
Cheers JED
Greg - 14 Jul 2004 16:09 GMT
John,
No easy task. \# 0.00 forces the zeroes whether they
should be there or not. \# 0.## eliminates the zeroes but
forces a decimal point "40." which looks odd. The
following is coded based on a number bookmarked as "Test"
and seems to work:
{ IF { REF Test } = { =INT({ REF Test}) }”{REF Test
\# “,0” }””{ REF Test \# “,0.###” }” }
Basically this is just comparing the value to the integer
of the value and if it matches it uses one format switch
and if not it uses another.
>-----Original Message-----
>In Word I am trying to format a number created from a formula,
[quoted text clipped - 16 lines]
>Cheers JED
>.
Greg - 14 Jul 2004 16:25 GMT
John,
I just looked at my first post in reply to your question
and it appears the speach marks were garbled.
Try:
>John,
>
>No easy task. \# 0.00 forces the zeroes whether they
>should be there or not. \# 0.## eliminates the zeroes
but
>forces a decimal point "40." which looks odd. The
>following is coded based on a number bookmarked as "Test"
[quoted text clipped - 6 lines]
>of the value and if it matches it uses one format switch
>and if not it uses another.
>-----Original Message-----
>In Word I am trying to format a number created from a formula,
[quoted text clipped - 16 lines]
>Cheers JED
>.
macropod - 15 Jul 2004 08:05 GMT
Hi John,
Have you tried:
{={MERGEFIELD}}
Cheers
> In Word I am trying to format a number created from a formula,
> examples below:
[quoted text clipped - 14 lines]
>
> Cheers JED
John Dempsey - 21 Jul 2004 22:53 GMT
Hi guys been away for a while sorry about the delay. This is great I
will try tommorrow at work and let you know my results. Macropod I
havent tried that its coming out of a SQL database so I think the
database gives it the two decimals, I just need it reduced.
Thanks for all your help with this.
John
> Hi John,
>
[quoted text clipped - 26 lines]
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.718 / Virus Database: 474 - Release Date: 9/07/2004
Graham Mayor - 22 Jul 2004 06:19 GMT
Plan B
You could use a conditional field to determine whether the decimal was 00 or
not and set the switch accordingly. There are probably several ways to do
this, but one which will work is:
{IF {=MOD({Mergefield Fieldname},1)} = 0 "{Mergefield Fieldname \#
",0;(0);"}" "{Mergefield Fieldname \# ",#.####;(,#.####)"}"}
If the field content is 0 this will display nothing. Otherwise
it will display up to four places of decimals with suppressed trailing zeros
and whole numbers will have comma thousand separators but no decimal point.

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Hi guys been away for a while sorry about the delay. This is great I
> will try tommorrow at work and let you know my results. Macropod I
[quoted text clipped - 35 lines]
>> Checked by AVG anti-virus system (http://www.grisoft.com).
>> Version: 6.0.718 / Virus Database: 474 - Release Date: 9/07/2004