Forum Discussion

speedyjkg's avatar
speedyjkg
Copper Contributor
Jul 24, 2023

Need Special Text Formula

I have a text string that looks like this: "Martha *Mary* Custis" and I'd like to print it out as "Martha Mary Custis".  I know how to get rid of the asterisks in the printed form of the name, but I can't figure out how to underline the text that is between the asterisks.  

 

Any thoughts?

 

Thank you in advance for your assistance,

Judy

  • speedyjkg Use a Wildcard Find and Replace, by inserting

     

    \*([A-z]{1,})\*

     

    into the Find what control and 

     

    \1 

     

    in the replace with control and while the selecting is in that control, click on Format and then Font and select the required underline style

     

     

     

    • speedyjkg's avatar
      speedyjkg
      Copper Contributor

      Doug_Robbins_Word_MVP 

       

      My apologies -- now that I reread my first posting, I realize that I left out some important information:

       

      I am building a mail merge in which the FirstName will come in looking like this:  Martha *Mary* Custis.  On the merged document, I want the asterisks removed and the text between the asterisks underlined.  I hope that these changes can all be stuffed into the MERGEFIELD formula (  { MERGEFIELD FirstName }  ).

       

      I can use the recommendation that you provided if I perform the mail merge to a new document and then run the Find/Replace at that point.  This will be something of a challenge for the user that I'm developing this for, but first I thought I'd check with the experts.  Having the conversion happen during the mail merge step will be easier for her than using the Find/Replace process afterward.

       

      Many thanks,

      Judy

      • speedyjkg Hi Judy,

        It is not possible during the mail merge process.  However assuming that you are using an Excel Data Source, or you copy the data to Excel to use as the data source, you could used the TEXTSPLIT function to separate the string into the individual words and then format the column that contains the middle name so that its text is underlined.

        If you want the text in a single field (though that should not be necessary) as you can combine the three fields in the mail merge main document), you could use the CONCATENATE function.

         

Resources