Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-27-2020, 02:22 PM
Alex1s85 Alex1s85 is offline MergeField multiple conditions (format date and delete previous text if blank) Windows 10 MergeField multiple conditions (format date and delete previous text if blank) Office 2016
Advanced Beginner
MergeField multiple conditions (format date and delete previous text if blank)
 
Join Date: Oct 2019
Location: Thessaloniki, Greece
Posts: 30
Alex1s85 is on a distinguished road
Default MergeField multiple conditions (format date and delete previous text if blank)

Hello everyone,




I'm facing an issue with mergefield editing.
I have to insert two conditions:

-Date format as: \@"dd-MM-yyyy"
- Delete previous text as: \b"Date: "



So, i tried to run this like:
MERGEFIELD Date \b"Date: " \@"dd-MM-yyyy"
But it displays only the date with the desired format.


Could anyone help me with this please?
Reply With Quote
  #2  
Old 07-27-2020, 03:56 PM
Charles Kenyon Charles Kenyon is offline MergeField multiple conditions (format date and delete previous text if blank) Windows 10 MergeField multiple conditions (format date and delete previous text if blank) Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
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 moved this to the mailmerge forum.


The \b switch does not insert text. It inserts a space.
{ IF { MERGEFIELD Date } <> "" "Date: { MERGEFIELD Date \@"dd-MM-yyyy" }" }
Reply With Quote
  #3  
Old 07-28-2020, 01:02 AM
macropod's Avatar
macropod macropod is offline MergeField multiple conditions (format date and delete previous text if blank) Windows 7 64bit MergeField multiple conditions (format date and delete previous text if blank) 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 Charles Kenyon View Post
The \b switch does not insert text. It inserts a space.
Not so - it can insert whatever content one desires. The real problem is that it doesn't work with other switches.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 07-28-2020, 05:43 AM
Alex1s85 Alex1s85 is offline MergeField multiple conditions (format date and delete previous text if blank) Windows 10 MergeField multiple conditions (format date and delete previous text if blank) Office 2016
Advanced Beginner
MergeField multiple conditions (format date and delete previous text if blank)
 
Join Date: Oct 2019
Location: Thessaloniki, Greece
Posts: 30
Alex1s85 is on a distinguished road
Default

I want to modify some templates which produce documents in live production.

Data comes from the core operational system - so to change the format in this data its not an option.


My data contains dates in format yyyy-dd-mm.


I have to merge dates in the format dd-mm-yyyy with the prefix "Date: " and to hide the mergefield in case that the date is not available.
Reply With Quote
  #5  
Old 07-28-2020, 09:36 AM
Charles Kenyon Charles Kenyon is offline MergeField multiple conditions (format date and delete previous text if blank) Windows 10 MergeField multiple conditions (format date and delete previous text if blank) Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
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

What I provided does what you want.
Attached is a document containing the field. I assume that your mergefield is named "Date."
Attached Files
File Type: docx mergefield 2020-07-28.docx (47.1 KB, 7 views)
Reply With Quote
  #6  
Old 07-28-2020, 12:30 PM
Alex1s85 Alex1s85 is offline MergeField multiple conditions (format date and delete previous text if blank) Windows 10 MergeField multiple conditions (format date and delete previous text if blank) Office 2016
Advanced Beginner
MergeField multiple conditions (format date and delete previous text if blank)
 
Join Date: Oct 2019
Location: Thessaloniki, Greece
Posts: 30
Alex1s85 is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
What I provided does what you want.
Attached is a document containing the field. I assume that your mergefield is named "Date."

You have right.
I didn't insert the "{}" with ctrl+F9.
It works really great!!


Thank you very much!


Best Regards
Reply With Quote
  #7  
Old 07-29-2020, 03:10 PM
Charles Kenyon Charles Kenyon is offline MergeField multiple conditions (format date and delete previous text if blank) Windows 10 MergeField multiple conditions (format date and delete previous text if blank) Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
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

You are welcome.

Few have not been caught by that. Experience builds skill, sometimes painful experience!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
MergeField multiple conditions (format date and delete previous text if blank) Delete comma and space after blank merged value. Also remove Previous space and word before blank Alex1s85 Mail Merge 4 01-18-2020 11:30 PM
Highlight Blank Cell Based on Multiple Conditions from Other Cells in Row PrincessApril Excel 3 11-21-2019 12:50 PM
MergeField multiple conditions (format date and delete previous text if blank) from text to table, with conditions depending on format Marco Word VBA 2 10-29-2015 06:40 PM
MergeField multiple conditions (format date and delete previous text if blank) multiple conditions, and blank cells with the countifs function jaden0605 Excel 1 03-30-2014 01:50 AM

Other Forums: Access Forums

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