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 / March 2008

Tip: Looking for answers? Try searching our database.

SUM of two mergefields with possible null values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bronco104 - 07 Mar 2008 21:10 GMT
I'm using Word 2007 to mailmerge invoice data from a DBF file.  The DBF file
presents two tax fields that we would like to add together and show as one
value on the invoice.  My formula for this is:

{ =SUM({ MERGEFIELD TAX },{ MERGEFIELD SECONDTAX}) }

However, we have gift invoices where the DBF file don't give any values for
taxes (null value), so my formula will return a syntax error.

I've tried to add an IF field to trap the null, but I'm new at this sort of
thing:

{ IF SUM({ MERGEFIELD TAX },{ MERGEFIELD SECONDTAX}) = "" "0" "SUM({
MERGEFIELD TAX },{ MERGEFIELD SECONDTAX})"}

All I get with this is the value of { MERGEFIELD TAX }, not the SUM of both.

Any help would be appreciated.
macropod - 07 Mar 2008 22:12 GMT
Hi bronco,

Try:
{={MERGEFIELD TAX \# 0.00}+{ MERGEFIELD SECONDTAX \# 0.00}}

Cheers
Signature

macropod
[MVP - Microsoft Word]
-------------------------

> I'm using Word 2007 to mailmerge invoice data from a DBF file.  The DBF file
> presents two tax fields that we would like to add together and show as one
[quoted text clipped - 14 lines]
>
> Any help would be appreciated.
bronco104 - 09 Mar 2008 18:18 GMT
Thank for the response, macro.
I've been able to add the two mergefields together previously... it's the
potential null values that are the issue here.  Whether I use my SUM function
or your suggestion, it works fine until my data file gives a null value.  I
then get syntax errors.  

I need to add something to handle null values when they crop up... maybe an
IF function?

>Hi bronco,
>
[quoted text clipped - 7 lines]
>>
>> Any help would be appreciated.
macropod - 09 Mar 2008 23:15 GMT
Hi bronco,

In that case, try:
{={IF{MERGEFIELD TAX}= "" 0 {MERGEFIELD TAX}}+{IF{MERGEFIELD SECONDTAX}= "" 0 {MERGEFIELD SECONDTAX}}}

Cheers
Signature

macropod
[MVP - Microsoft Word]
-------------------------

> Thank for the response, macro.
> I've been able to add the two mergefields together previously... it's the
[quoted text clipped - 16 lines]
>>>
>>> Any help would be appreciated.
bronco104 - 10 Mar 2008 21:46 GMT
Macro,
That got it.  Thanks for your help!

>Hi bronco,
>
[quoted text clipped - 7 lines]
>>>>
>>>> Any help would be appreciated.
 
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.