Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-14-2021, 08:19 AM
IanT IanT is offline Multiple actions in an IF statement Windows 10 Multiple actions in an IF statement Office 2016
Novice
Multiple actions in an IF statement
 
Join Date: Jan 2021
Posts: 3
IanT is on a distinguished road
Default Multiple actions in an IF statement

Hi

Is it possible have multiple actions in an IF statement i.e. I want to combine some fixed text and mergefield together. An IF statement do to something like this

IF "condition" = "A" then "Correct" else "First Letter was " {MERGEFIELD FirstLetter}

E.g.
{ IF { MERGEFIELD FirstLetter } = "A" "Correct" "First Letter was " { MERFGEFIELD FirstLetter } }


FirstLetter = A you get "Correct"
FirstLetter = B you get "First Letter was B"



Is this possible or do I need multiple IF's?

TIA
Iam
Reply With Quote
  #2  
Old 01-14-2021, 01:36 PM
macropod's Avatar
macropod macropod is offline Multiple actions in an IF statement Windows 10 Multiple actions in an IF statement Office 2016
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 IanT View Post
IF "condition" = "A" then "Correct" else "First Letter was " {MERGEFIELD FirstLetter}

E.g.
{ IF { MERGEFIELD FirstLetter } = "A" "Correct" "First Letter was " { MERFGEFIELD FirstLetter } }


FirstLetter = A you get "Correct"
FirstLetter = B you get "First Letter was B"

Is this possible or do I need multiple IF's?
Yes. Depending on what you're trying to achieve, the IF tests can be sequential or nested.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-15-2021, 02:15 AM
IanT IanT is offline Multiple actions in an IF statement Windows 10 Multiple actions in an IF statement Office 2016
Novice
Multiple actions in an IF statement
 
Join Date: Jan 2021
Posts: 3
IanT is on a distinguished road
Default

So I need multiple IF's to do this, I can't do it in one?
Reply With Quote
  #4  
Old 01-15-2021, 02:41 AM
macropod's Avatar
macropod macropod is offline Multiple actions in an IF statement Windows 10 Multiple actions in an IF statement Office 2016
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

Well, the field syntax depicted in your initial post is close to being correct for what you described, but it's not clear what else you're trying to achieve. The correct syntax is:
Code:
{ IF { MERGEFIELD FirstLetter } = "A" "Correct" "First Letter was { MERFGEFIELD FirstLetter }" }
Note the re-located position of the final double-quote character.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 01-15-2021, 03:13 AM
IanT IanT is offline Multiple actions in an IF statement Windows 10 Multiple actions in an IF statement Office 2016
Novice
Multiple actions in an IF statement
 
Join Date: Jan 2021
Posts: 3
IanT is on a distinguished road
Default

Hi

I get it now.

Many thanks
Ian
Reply With Quote
Reply

Tags
if multiple actions

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a Select statement in Excel to an update statement shabbaranks Excel Programming 5 10-31-2018 11:47 PM
Actions assistance aw12 PowerPoint 2 12-14-2017 01:49 PM
Multiple actions in an IF statement Using multiple conditions with an IF statement?? to show a yes/no value BlindMouse Excel 1 01-27-2016 12:19 AM
Standardise repeated actions TiVivibi PowerPoint 0 10-10-2014 02:06 PM
Multiple actions in an IF statement run multiple actions with macro hudsontucker13 PowerPoint 2 11-22-2013 07:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:41 PM.


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