#1
|
|||
|
|||
Mergefield Consisting of Concatenated Strings
I'm working on a complex rule for a mail merge field ...
If mail merge field 'r1_relchg' is blank (="") then display "", otherwise display 'r1_sru' (h:mmA/P) - 'r1_srl' (h:mmA/P) An example of the presentation if r1_relchg <> "" might be: 9:00A-9:30P I am not certain how, if its possible, to concatenate the 'r1_sru', '-'. and 'r1_srl' |
#2
|
||||
|
||||
Ordinarily, one would simply use a field coded as:
{IF«r1_relchg» = "" "" "«r1_sru»-«r1_srl»"} If the «r1_sru» & «r1_srl» mergefields are blank when there's no data, one could instead use a field between them coded as: «r1_sru»{IF«r1_relchg» = "" "" "-"}«r1_srl»
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thank you Paul ... I have some tedious time fields to concatenate.
|
#4
|
||||
|
||||
ah, c'mon, it's not that hard
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Hey Paul ...
This is what I came up .... I got the same results as you ... and they weren't really the results I was looking for. With my data, one record with r1_relchg = "REL", I was given the following results with both scripts: 12:00 A-12:00 A r1_srl = 9:30 AM ... confirmed time value, no other dta in the column, just blank cells. r1_sru = 10:00 AM ... confirmed time value, no other dta in the column, just blank cells. Real estate in the cell is tight, so I am also trying to eliminate the space between the number and the AM/PM. |
#6
|
||||
|
||||
So what do you get with just:
{IF{MERGEFIELD r1_relchg}<> "" "{MERGEFIELD r1_srl \@ "h:mm"}-{MERGEFIELD r1_sru \@ "h:mm"}"}
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
That worked Paul. It blows my mind that we we were able to concatenate two time strings with simple switches, but to simply use time as itself in a field required a paragraph of formula. (mind you I haven't tried this in the actual report yet ... it may behave quite differently)
How can the A or P for AM or PM be added? I tried the standard method of formatting but it came out looking like this ... 9:30九P -10:00九P {IF{MERGEFIELD r1_relchg}<> "" "{MERGEFIELD r1_srl \@ "h:mmA/P"}-{MERGEFIELD r1_sru \@ "h:mmA/P"}"} |
#8
|
||||
|
||||
Quote:
Quote:
{IF{MERGEFIELD r1_relchg}<> "" "{MERGEFIELD r1_srl \@ "h:mm AM/PM"}-{MERGEFIELD r1_sru \@ "h:mm AM/PM"}"} but I didn't bother with that because you said:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
Turns out the simple method didn't work in the report. All I was able to manage with that was concatenated decimals.
The original (long) way of doing it seems to be working so far, and with it I managed to just retain either the A or P of AM/PM with the time. I often format my times in Excel as h:mmA/P which leaves me with 8:30A. I just assumed this was possible in Word as well, so that's what I was aiming for. Thanks Paul! |
#10
|
||||
|
||||
Instead of the AM/PM you might consider using a lower-case am/pm, which is a bit narrower or using the std 24-hour time format. You could also reduce in internal cell margin spacing in the affected cells.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
Great ideas! I'm going to combine a couple to achieve what I'm looking for.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
Save merged document as concatenated merge field values | texas791 | Word VBA | 4 | 02-25-2014 07:35 PM |
Search with multiple strings | silverspr | Excel | 7 | 03-03-2013 04:45 PM |
Concatenated data in subsequent rows | doorsgirl | Excel | 4 | 09-15-2011 10:37 PM |
update style of all strings available between two specific strings | vikrantkale | Word | 1 | 03-28-2011 06:13 PM |