Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / May 2007

Tip: Looking for answers? Try searching our database.

Large dollar amount switch

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Todd K. - 26 Apr 2007 13:26 GMT
In one of my merge documents, I use the \*DollarText field switch to format
the dollar amount in words.  It has worked fine until now, but we just got a
dollar amount over $1 million and I'm getting an error because the number is
too high.  Is there a fix for this?
Peter Jamieson - 26 Apr 2007 13:53 GMT
In the U.S. you can probably use

{ SET x { MERGEFIELD mylargenumber }

}{ SET r { =MOD(x,1000000) }
}{ SET m { =INT(x-r)/1000000)) }
}{ IF { m } = 0 "" "{ m \*Cardtext } million }" }{ r \Cardtext }

to go a bit larger. You might need to check the calculations better than I
have.

But you can modify the technique anyway to separate out each digit and
convert it to a word.

Peter Jamieson
> In one of my merge documents, I use the \*DollarText field switch to
> format
[quoted text clipped - 3 lines]
> is
> too high.  Is there a fix for this?
Todd K. - 26 Apr 2007 15:40 GMT
Do I paste all of this into the Mergefield or is this code I have to set up
elsewhere?

> In the U.S. you can probably use
>
[quoted text clipped - 18 lines]
> > is
> > too high.  Is there a fix for this?
Peter Jamieson - 26 Apr 2007 15:46 GMT
it would replace whatever merge field codes you are using now in your Word
document.

In essence, enter the {} pairs into your document using ctrl-F9. Type
everything else in the usual way. Use Alt-F9 to toggle between "field codes"
view and "field results" view. Select the field and press F9 to update the
results.

Peter Jamieson

> Do I paste all of this into the Mergefield or is this code I have to set
> up
[quoted text clipped - 25 lines]
>> > is
>> > too high.  Is there a fix for this?
Todd K. - 08 May 2007 14:20 GMT
I tried it and I'm getting a result of 0.0, but I noticed two inconsistencies
in your code:
1) you have one too many right brackets "}"
2) on your "SET m" line, there are two closing brackets without opening
brackets "))"

> it would replace whatever merge field codes you are using now in your Word
> document.
[quoted text clipped - 35 lines]
> >> > is
> >> > too high.  Is there a fix for this?
Doug Robbins - Word MVP - 08 May 2007 15:14 GMT
The correct field construction is:

{ SET x { MERGEFIELD mylargenumber }}{ SET r { =MOD(x,1000000) }}
{ SET m { =INT((x-r)/1000000) }}
{ IF { m } = 0 "" "{ m \*Cardtext } million "}{ r \Cardtext }

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I tried it and I'm getting a result of 0.0, but I noticed two
>inconsistencies
[quoted text clipped - 48 lines]
>> >> > is
>> >> > too high.  Is there a fix for this?
Peter Jamieson - 08 May 2007 15:20 GMT
Yes, there should also be a * before the second "Cardtext". Try:

{ SET x { MERGEFIELD mylargenumber }
}{ SET r { =MOD(x,1000000) }
}{ SET m { =INT((x-r)/1000000)) }
}{ IF { m } = 0 "" "{ m \*Cardtext } million " }{ r \*Cardtext }

Other than that, it seems OK here - what values do you have in your
"mylargenumber" ?

What is the result of { x } ?

Peter Jamieson

>I tried it and I'm getting a result of 0.0, but I noticed two
>inconsistencies
[quoted text clipped - 48 lines]
>> >> > is
>> >> > too high.  Is there a fix for this?
Todd K. - 08 May 2007 16:28 GMT
Wow, thank you all so much.  I actually made a couple of other changes, as
this is for dollars and needed to be in all capitals, so my final code looks
like this:

{ SET x { MERGEFIELD mylargenumber }
}{ SET r { =MOD(x,1000000) }
}{ SET m { =INT((x-r)/1000000) }
}{ IF { m } = 0 "" "{ m \*Cardtext\*Upper } MILLION" }{ r
\*Dollartext\*Upper }

But it works great.  Kudos to you.

> Yes, there should also be a * before the second "Cardtext". Try:
>
[quoted text clipped - 62 lines]
> >> >> > is
> >> >> > too high.  Is there a fix for this?
Graham Mayor - 08 May 2007 15:25 GMT
It is very easy to make minor mistakes in transposing fields to text strings
but what I suspect Peter really meant was

{  SET x { Mergefield MyLargeNumber  }
}{  SET r { =MOD(x,1000000) }
}{  SET m { =INT((x-r)/1000000)  }
}{ IF{   m  } = 0 "{=INT({ r })\*Cardtext  }" "{ =INT({  m }) \*Cardtext  }
million " }

This works for me (for integers). To aid the copying of field construction
to text use the macro at http://www.gmayor.com/export_field.htm. That way
you don't get the mistakes ;)

If you have decimals with the numbers (or these are currency amounts)  then
further calculations will be required.- see the section formatting cash
amounts in words at http://www.gmayor.com/formatting_word_fields.htm

Signature

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

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

> I tried it and I'm getting a result of 0.0, but I noticed two
> inconsistencies in your code:
[quoted text clipped - 41 lines]
>>>>> is
>>>>> too high.  Is there a fix for this?

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.