Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to 'freeze' mergefields so that only the values are left? | Mailmerge | |||
Problem arises when ref bookmark is added in the header ,it does not take the modified values and displays the same old values | Microsoft Word Help | |||
Problem arises when ref bookmark is added in the header ,it does not take the modified values and displays the same old values | Microsoft Word Help | |||
how to set text box default to null | Mailmerge | |||
remove mergefields, keep values | Mailmerge |