Mail Merge losing superscript formatting

Hello!

I am trying to use mail merge to transfer numbers with superscript following them (i.e. 1st, where 'st' is in superscript). I am transferring the text from an Excel file to a Word document using Mail Merge, but I haven't had any luck retaining the formatting.

I also tried to figure out a way to make Word change the text to superscript automatically after the merge is complete, but I'm not sure how to do this either.

Any help would be appreciated!

I think that the only way you will be able to achieve that is to split the field in Excel into 2 or 3 parts so that the characters that are required to be in superscript are in a cell by themselves and then for the merge field that contains those characters, replace the \* MERGEFORMAT (if there is one) in the field code that is displayed in Word when you use Alt+F9 to toggle on the display of the field codes with \* CHARFORMAT, or add that inside the closing field delimiter } and then apply superscript formatting to the M of MERGEFIELD.
Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Assuming the ordinal number is the only thing in the column, you could use a field in Word coded as:

{QUOTE{Set Val {MERGEFIELD MyField \#0}}"{=Val \#0}{IF{=(MOD({={=Val}+89},100)>2)*(MOD({={=Val}+9},10)<3)}= 1 {=MOD({=Val},10)-2 \# rd;st;nd} th}"}

where 'MyField' is your field name and the 'rd;st;nd' and'th' strings in the field code are all superscripted. With this approach, it doesn't even matter whether the Excel data are in an ordinal format.

Even if the mergefield returns a date, it's possible to use field coding to apply superscript numbering (e.g. 29th October 2014). For the basic field coding to do that, see 'Insert A Date with Ordinal Numbering' (from which the above example is derived) in my Microsoft Word Date Calculation Tutorial, which you can download from:
http://windowssecrets.com/forums/showthread.php/154368-Microsoft-Word-Date-Calculation-Tutorial
or:
http://www.gmayor.com/downloads.htm#Third_party
Do read the document's introductory material.

Note: The field brace pairs (i.e. '{ }') for the above example are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues. The spaces represented in the field construction are all required.

Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

1. The following field coding (with or without an enclosing QUOTE field) may be a little more obvious for many, at least assuming that they understand what "mod" does.

{ SET v { MERGEFIELD MyField \#0 } }{ v }{ IF { v \*Ordinal } = *h th { =mod(v,10)-2 \#rd;st;nd } }

(You can lose a few more spaces in there if you prefer, but the same notes apply as inPaul's message, i.e. primarily that all the {  } have to be the special field code braces that you can insert using ctrl-F9 on Windows Word). In this case, you also have to ensure that the { v \*Ordinal } field is formatted as English language.


2. If your Excel sheet happens to contain the ordinals in a format where there is some kind of space between the number and the "Ordinal indicator" st, nd etc., and every single value in the column is in that format (no empty cells etc.) then you could in theory achieve this using the \*MERGEFORMAT switch. You use

{ MERGEFIELD MyField \*Mergeformat }

Then you show the result of one of the values, and format the result so that

 a. the ordinal indicator (st, rd etc.) is superscripted
 b. the spacing character is either hidden or made much smaller (e.g. using a small font size.

That's really what \*Mergeformat was originally intended to achieve, but it is so dependent on the consistency of the data that I doubt if many people rely on it.

3. Again, in theory, if you are merging to a single output file, e.g. via a Directory merge (Catalog merge on Mac), you could postprocess the file using autoformat. You would need to go and find the Option in Word->Options and put it in your QAT. Then, when you open the dialog box, you'll need to go into the Options... and uncheck everything except the "Oridinals (1st) with Superscript" option. (It may be different on Word 2013). But I wouldn't entirely trust that not to change other things unexpectedly.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thank you so much! This solution works very well and I never would have figured it out on my own!

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated November 4, 2024 Views 5,394 Applies to: