Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-01-2018, 07:49 AM
Louiseaf Louiseaf is offline How can I write a complex if_then_else statement in Word Windows 10 How can I write a complex if_then_else statement in Word Office 2016
Novice
How can I write a complex if_then_else statement in Word
 
Join Date: Oct 2018
Posts: 3
Louiseaf is on a distinguished road
Exclamation How can I write a complex if_then_else statement in Word

Hello

I am having a bit of difficulty figuring out a way to get this statement to work. I am pulling data from an online recruitment portal so my data source isn't particularly flexible.

This is the text:

(this line always appears)Please note that this offer is subject to the following conditions:
{IF{ MERGEFIELD pvgdisclosure}="PVG Children"
• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to children " ""}{IF{ MERGEFIELD pvgdisclosure}="PVG Adults"


• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults" ""}{IF{ MERGEFIELD pvgdisclosure}="PVG Both"
• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults and Children" ""}{IF{ MERGEFIELD gtcs_apply}="Yes"
• GTCS: You successfully gain and maintain registration with the GTCS. " ""}{IF{ MERGEFIELD sssc_apply}="Yes"
• SSSC: You successfully gain and maintain registration with the Scottish Social Service Council. " ""}

The above currently works. However what I want to set is if none of the above applies, I want the merge to input this line:
•There are no applicable conditions to this offer.

Hopefully that makes sense?
Reply With Quote
  #2  
Old 10-01-2018, 01:56 PM
macropod's Avatar
macropod macropod is offline How can I write a complex if_then_else statement in Word Windows 7 64bit How can I write a complex if_then_else statement in Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can achieve that by nesting the fields. For example:
{IF{MERGEFIELD pvgdisclosure}= "PVG Children" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to children" {IF{MERGEFIELD pvgdisclosure}= "PVG Adults" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults" {IF{MERGEFIELD pvgdisclosure}= "PVG Both" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults and Children" "• There are no applicable conditions to this offer."}}}

It's not apparent, though, how your last two mergefields relate to this.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 10-01-2018, 11:21 PM
Louiseaf Louiseaf is offline How can I write a complex if_then_else statement in Word Windows 10 How can I write a complex if_then_else statement in Word Office 2016
Novice
How can I write a complex if_then_else statement in Word
 
Join Date: Oct 2018
Posts: 3
Louiseaf is on a distinguished road
Default

Thanks for the swift reply Macropod. Essentially there are three questions relating to the pre-employment checks required and some, all or none will apply to an offer.

When building a nested statement, I understand to use ctrl+F9 to get the {} - can I just manually type the rest in it or are there other tricks I must use? I have tried gogling this but I can't seem to find a guide which relates to using multiple data inputs.
Reply With Quote
  #4  
Old 10-01-2018, 11:35 PM
macropod's Avatar
macropod macropod is offline How can I write a complex if_then_else statement in Word Windows 7 64bit How can I write a complex if_then_else statement in Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Louiseaf View Post
When building a nested statement, I understand to use ctrl+F9 to get the {} - can I just manually type the rest in it or are there other tricks I must use?
You could use the Ctrl-F9 approach to build the fields. However, if you already have your three IF tests, you can simply nest them. For example:

{IF{MERGEFIELD pvgdisclosure}= "PVG Both" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults and Children" ""}

and:

• There are no applicable conditions to this offer.

become:

{IF{MERGEFIELD pvgdisclosure}= "PVG Both" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults and Children" "• There are no applicable conditions to this offer."}

just by dragging '• There are no applicable conditions to this offer.' into the existing final field code. Similarly:

{IF{MERGEFIELD pvgdisclosure}= "PVG Adults" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults" ""}

and:

{IF{MERGEFIELD pvgdisclosure}= "PVG Both" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults and Children" "• There are no applicable conditions to this offer."}

become:

{IF{MERGEFIELD pvgdisclosure}= "PVG Adults" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults" "{IF{MERGEFIELD pvgdisclosure}= "PVG Both" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults and Children" "• There are no applicable conditions to this offer."}"}

just by dragging the combined field from the previous process into the preceding field code. And, by doing that one more time, you end up with:

{IF{MERGEFIELD pvgdisclosure}= "PVG Children" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to children" "{IF{MERGEFIELD pvgdisclosure}= "PVG Adults" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults" "{IF{MERGEFIELD pvgdisclosure}= "PVG Both" "• PVG: You successfully gain and maintain membership of the Protecting Vulnerable Groups scheme in relation to Adults and Children" "• There are no applicable conditions to this offer."}"}"}

The only (inconsequential) difference between that an what I suggested in post #2 is that I've left in some redundant double-quotes in this post.

Alternatively, you could use the macro found under Convert Text Representations of Fields to Working Fields in the Mailmerge Tips and Tricks 'Sticky' thread at the top of this forum (https://www.msofficeforums.com/mail-...ps-tricks.html) to convert the text representations of the field code in this post or post #2 into a working field code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 10-09-2018, 03:38 AM
Louiseaf Louiseaf is offline How can I write a complex if_then_else statement in Word Windows 10 How can I write a complex if_then_else statement in Word Office 2016
Novice
How can I write a complex if_then_else statement in Word
 
Join Date: Oct 2018
Posts: 3
Louiseaf is on a distinguished road
Default

Thanks for your reply, I can get this to work for the PVG question, but how do I incorporate the SSSC and GTCS questions into the formula?
Reply With Quote
  #6  
Old 10-09-2018, 03:43 AM
macropod's Avatar
macropod macropod is offline How can I write a complex if_then_else statement in Word Windows 7 64bit How can I write a complex if_then_else statement in Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Before I can answer that, I'd need to know how those questions relate to the others. As I said in post #2, that relationship is by no means apparent.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex IF(AND statement to manipulate weighted grades - better way? ddeaton Excel 11 07-11-2016 02:03 PM
How can I write a complex if_then_else statement in Word I'm not able to write any thing in my MS WORD 2007. Arfan Word 1 09-10-2014 11:25 AM
write need help and copy write need help on another page auto wykoems Word 2 07-25-2013 07:56 AM
How can I write a complex if_then_else statement in Word Searching for Word Reformatter for Complex Docs jchapman Word 1 05-05-2011 04:50 PM
How can I write a complex if_then_else statement in Word How to write a table of contents in word ugurkocak1980 Word 4 05-31-2010 06:10 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:25 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