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.