Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
bronco104 bronco104 is offline
external usenet poster
 
Posts: 1
Default SUM of two mergefields with possible null values

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.

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod macropod is offline
external usenet poster
 
Posts: 1,002
Default SUM of two mergefields with possible null values

Hi bronco,

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

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

"bronco104" u41930@uwe wrote in message news:80d11d5482e29@uwe...
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.

  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
bronco104 via OfficeKB.com bronco104 via OfficeKB.com is offline
external usenet poster
 
Posts: 2
Default SUM of two mergefields with possible null values

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?

macropod wrote:
Hi bronco,

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

Cheers
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.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...merge/200803/1

  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod macropod is offline
external usenet poster
 
Posts: 1,002
Default SUM of two mergefields with possible null values

Hi bronco,

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

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

"bronco104 via OfficeKB.com" u41930@uwe wrote in message news:80e83cca2ab0a@uwe...
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?

macropod wrote:
Hi bronco,

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

Cheers
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.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...merge/200803/1

  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
bronco104 via OfficeKB.com bronco104 via OfficeKB.com is offline
external usenet poster
 
Posts: 2
Default SUM of two mergefields with possible null values

Macro,
That got it. Thanks for your help!

macropod wrote:
Hi bronco,

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

Cheers
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.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...merge/200803/1

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to 'freeze' mergefields so that only the values are left? Peter Fl. Adolph Mailmerge 1 July 19th 07 10:23 AM
Problem arises when ref bookmark is added in the header ,it does not take the modified values and displays the same old values divya Microsoft Word Help 2 July 6th 06 01:08 PM
Problem arises when ref bookmark is added in the header ,it does not take the modified values and displays the same old values divya Microsoft Word Help 0 July 6th 06 11:47 AM
how to set text box default to null [email protected] Mailmerge 2 January 5th 06 10:38 PM
remove mergefields, keep values Jim Zoupas Mailmerge 2 March 15th 05 08:25 AM


All times are GMT +1. The time now is 11:44 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"