Results 1 to 5 of 5

Thread: Help! with SSN

  1. #1
    New Lounger
    Join Date
    Apr 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have created a mail merge doc in which I want to return a SSN, but only display the last four digits, with "X" in the first six, as in XXX-XX-6789. I can't seem to find much on this. Any suggestions?

    Thanks!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Welcome to the Lounge!

    Right-click the SSN merge field and select Toggle Field Codes from the popup menu.
    You'll see something like this:

    { MERGEFIELD "SSN" }

    or

    { MERGEFIELD "SSN" \* MERGEFORMAT }

    where SSN is the name of the merge field. Edit the field code to look like this:

    { MERGEFIELD "SSN" \# "'XXX-XX-'x0000" }

    Press F9 to hide the field code and to update the result.

  3. #3
    New Lounger
    Join Date
    Apr 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks! I'll give it a shot. Great site, btw.

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='ejohn' post='771459' date='21-Apr-2009 06:58']I have created a mail merge doc in which I want to return a SSN, but only display the last four digits, with "X" in the first six, as in XXX-XX-6789. I can't seem to find much on this. Any suggestions?

    Thanks![/quote]
    Hi ejohn,

    If your SSN data are in the form 123-45-6789, you can achieve the result you're after with a field coded as:
    {QUOTE
    {SET ID {MERGEFIELD SSN}}
    {SET EXP3{=({ID}*(-1)-ID)/2}}"XXX-XX-"{EXP3 \# 0000}}

    If your SSN data are in the form 123456789, you can achieve the result you're after with a field coded as:
    {QUOTE{=MOD({MERGEFIELD SSN},10000) \# "'XXX-XX-'0000"}}

    Note: The field brace pairs (ie '{ }') for the above examples are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    New Lounger
    Join Date
    Apr 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, guys. My solution was very similar to that proposed by Hans, and worked, to a degree. As an example, if the ssn at issue was xxx-xx-1234, it would return something of the nature of xxx-xx-4264. I was not able to determine an explanation as to where this number was generated. Paul, your solution worked wonderfully. Your input has saved my secretary a great deal of work, and she is elated.

    Thanks, again.

    ejohn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •