Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2022, 09:59 AM
MLSTyburg MLSTyburg is offline If/Then/Else statement using presence of a / vs not present as criteria Windows 10 If/Then/Else statement using presence of a / vs not present as criteria Office 2019
Novice
If/Then/Else statement using presence of a / vs not present as criteria
 
Join Date: Jan 2022
Posts: 2
MLSTyburg is on a distinguished road
Default If/Then/Else statement using presence of a / vs not present as criteria

I'm using a sort_name field in Excel as my criteria to merge information into my word document. Within the sort_name field there is always data; some with a / separating lname from fname and sometimes it is the name of an organization (no lname/fname). I'm not successfully using the criteria of the / to distinguish whether or not to imput something in my document or not. Does anyone know if that is possible.


Currently my merge statement looks like:
{ IF {MERGEFIELD sort_name} <> */* "via the {MERGEFIELD sort_name} " " " }
the result of the above is inserting the contents of ALL sort_name fields in each letter.

My thought is IF sort_name contains / insert sort_name IF NOT don't insert anything.
Reply With Quote
  #2  
Old 01-11-2022, 03:31 PM
macropod's Avatar
macropod macropod is offline If/Then/Else statement using presence of a / vs not present as criteria Windows 10 If/Then/Else statement using presence of a / vs not present as criteria 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

As discussed under the 'Test Whether a Mergefield Contains a Given String' topic in the Mailmerge Tips & Tricks 'Sticky' thread at the top of this forum (https://www.msofficeforums.com/mail-...ps-tricks.html), you would have to know the position of the '/' character. A '*/*' test is not possible. If the '/' can appear in numerous positions, you'd need to construct a compound test against each of those positions. For example:
{QUOTE{SET Data MERGEFIELD MyField}{IF{={IF{REF Data}= "?/*" 1 0}+{IF{REF Data}}= "??/*" 1 0}+{IF{REF Data}}= "???/*" 1 0}+{IF{REF Data}}= "????/*" 1 0}+{IF{REF Data}}= "?????/*" 1 0}> 0 "/ Found" "/ Not Found"}}
Even then, Word can't parse the field to split out the sort_name.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-11-2022, 04:26 PM
MLSTyburg MLSTyburg is offline If/Then/Else statement using presence of a / vs not present as criteria Windows 10 If/Then/Else statement using presence of a / vs not present as criteria Office 2019
Novice
If/Then/Else statement using presence of a / vs not present as criteria
 
Join Date: Jan 2022
Posts: 2
MLSTyburg is on a distinguished road
Default

Ah, that is very helpful. and I'm sorry I am still familiarizing myself with the forum.
Reply With Quote
Reply

Tags
if/then/else, mergefields

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
If/Then/Else statement using presence of a / vs not present as criteria Create a unique list of values that match a criteria, sorted in order of another criteria BradRichardson Excel 2 01-03-2017 12:25 AM
If/Then/Else statement using presence of a / vs not present as criteria Sum based on multiple criteria (one of the criteria is not unique) until a threshold is reached. phillipsdp Excel 1 11-09-2016 12:53 AM
Outlook, 5 day appointments and communicator presence dowalker Outlook 0 10-28-2011 12:23 PM
If/Then/Else statement using presence of a / vs not present as criteria Conditional color fill based on presence of data avanderh Excel 11 07-28-2011 09:10 AM

Other Forums: Access Forums

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