Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-19-2023, 08:41 AM
mxdelene's Avatar
mxdelene mxdelene is offline How to implement addition into a nested IF mergefield? Windows 10 How to implement addition into a nested IF mergefield? Office 2021
Novice
How to implement addition into a nested IF mergefield?
 
Join Date: Dec 2023
Location: Somerset, UK
Posts: 4
mxdelene is on a distinguished road
Default How to implement addition into a nested IF mergefield?


Hi all!
I've recently been teaching myself how to use basic merge fields in a professional template, and I've hit a bit of a wall when it comes to nested IF statements. I haven't seen anyone talk about this so I thought id put it out there.

Code:
{IF {MERGEFIELD MFC_testlookup1} = "Yes" "82" +
   {IF {MERGEFIELD MFC_testlookup2} = "Yes" "82" +
      {IF {MERGEFIELD MFC_testBusinessType} = "Couple" "164" ""}}}
Each mergefield has a variable that needs to be added together at the end, so assuming they are all 'true', the total output should be 328. Obviously it doesn't work, but this is the only method of doing this I can think of; then again I'm pretty new to this so any help is highly appreciated!
Reply With Quote
  #2  
Old 12-19-2023, 09:53 AM
Charles Kenyon Charles Kenyon is offline How to implement addition into a nested IF mergefield? Windows 11 How to implement addition into a nested IF mergefield? Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I think you need to add calculation fields into this.
= (Formula) field - Office Support
What is it you are trying to accomplish?
Reply With Quote
  #3  
Old 12-20-2023, 01:59 AM
mxdelene's Avatar
mxdelene mxdelene is offline How to implement addition into a nested IF mergefield? Windows 10 How to implement addition into a nested IF mergefield? Office 2021
Novice
How to implement addition into a nested IF mergefield?
 
Join Date: Dec 2023
Location: Somerset, UK
Posts: 4
mxdelene is on a distinguished road
Default

Thank you so much for your reply! Ill look through the attached link now.
But I had the intention of creating a function that could add all of the results together if the merge fields were present/correct (I work in legal and would want to automate this as opposed to having to manually type it).

I will also continue to look through Paul Edstein's field math document and if I find a solution Ill make sure to post it on here.

Last edited by Charles Kenyon; 12-20-2023 at 09:35 AM. Reason: added link to field maths tutorial
Reply With Quote
  #4  
Old 12-20-2023, 09:34 AM
Charles Kenyon Charles Kenyon is offline How to implement addition into a nested IF mergefield? Windows 11 How to implement addition into a nested IF mergefield? Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by mxdelene View Post
Thank you so much for your reply! Ill look through the attached link now.
But I had the intention of creating a function that could add all of the results together if the merge fields were present/correct (I work in legal and would want to automate this as opposed to having to manually type it).

I will also continue to look through Paul Edstein's field math document and if I find a solution Ill make sure to post it on here.
This can be automated.

An IF Field contains truetext and falsetext parts. It does not contain subtraction or addition except as part of the test, that would be part of the calculation field.
A calculation field can contain merge fields that are in IF Fields.
Dealing with Fields in Microsoft Word
Reply With Quote
  #5  
Old 12-20-2023, 10:01 AM
mxdelene's Avatar
mxdelene mxdelene is offline How to implement addition into a nested IF mergefield? Windows 10 How to implement addition into a nested IF mergefield? Office 2021
Novice
How to implement addition into a nested IF mergefield?
 
Join Date: Dec 2023
Location: Somerset, UK
Posts: 4
mxdelene is on a distinguished road
Default

Hi Charles,
Unfortunately I don't think it is doable then, as this statement is dependent on whether or not the conditional statement can be involved.

For more context, each mergefield is linked to a part of the database we use, such as sourcing whether or not the client has an attorney, and if yes, the charge will be £82, so on and so forth. The charges will then supposedly be added together if they appear as true. Can this work as an if statement? Or do I have to stick with a Formula.

I've not really gotten too far with this
Reply With Quote
  #6  
Old 12-20-2023, 06:46 PM
Charles Kenyon Charles Kenyon is offline How to implement addition into a nested IF mergefield? Windows 11 How to implement addition into a nested IF mergefield? Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

It can work with If fields, yes.
{ = { If { MergeField HasAttorney } = "True" "£82" "0" } + { If { MergeField Day } >= 3 "2" "0" } }
This assigns a given amount to be included in the addition given passing a test. If the condition is not met you could have nothing or have a 0.
Reply With Quote
  #7  
Old 12-21-2023, 04:12 AM
mxdelene's Avatar
mxdelene mxdelene is offline How to implement addition into a nested IF mergefield? Windows 10 How to implement addition into a nested IF mergefield? Office 2021
Novice
How to implement addition into a nested IF mergefield?
 
Join Date: Dec 2023
Location: Somerset, UK
Posts: 4
mxdelene is on a distinguished road
Default

Thank you Charles it works

The finished result of what I'm going to use is below, and looking at it now I feel a bit silly its so straightforward.

Code:
{ = { IF {MERGEFIELD HasAttorney} = "Yes" "82" "0" } + { IF { MERGEFIELD HasLPA } = "Yes" "82" "0" } }
The result for the most part either being 82 or 164 depending on the database client.

Thank you again!
Reply With Quote
Reply

Tags
if statements, merge fields, nested merge



Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for a way to implement building blocks lodi123 PowerPoint 3 08-03-2017 04:33 AM
How to implement addition into a nested IF mergefield? “nested” IF/Then with Mergefield, utilizing Conga and Salesforce links. aronfromct Mail Merge 7 05-16-2017 05:39 AM
How to implement addition into a nested IF mergefield? Addition James__S Word 1 08-18-2016 06:20 PM
How to implement addition into a nested IF mergefield? Printing selected pages based on a MERGEFIELD.g. If MERGEFIELD=x then print pages 1,2,4 if MERGEFIEL Richard.p Word 3 04-21-2015 01:14 AM
How to implement addition into a nested IF mergefield? How do I implement Outlook? Saturn1 Office 7 05-27-2005 09:57 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft