Microsoft Office Forums Mergefield - Replace Prefix of Document Number

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-09-2019, 09:53 AM
boonlailee boonlailee is offline Mergefield - Replace Prefix of Document Number Windows 10 Mergefield - Replace Prefix of Document Number Office 2019
Novice
Mergefield - Replace Prefix of Document Number
 
Join Date: Jun 2019
Posts: 6
boonlailee is on a distinguished road
Default Mergefield - Replace Prefix of Document Number

Hi, i need help on this:



Field Name: DocNumber

Sample of DocNumber (this is actually the invoice number):

INV-0001
INV-0002
INV-0003
INV-0004


I making use of this mergefield «DocNumber» to create my DeliveryOrder bearing SAME numbering, however i need it to be in different "Prefix" as per below:

DO-0001
DO-0002
DO-0003
DO-0004

Please help.
Thanks.

Boon Lai
Reply With Quote
  #2  
Old 06-09-2019, 03:48 PM
macropod's Avatar
macropod macropod is offline Mergefield - Replace Prefix of Document Number Windows 7 64bit Mergefield - Replace Prefix of Document Number Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,577
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Simple:
1. Select your «DocNumber» mergefield and press Shift-F9. You should see:
{ MERGEFIELD DocNumber }
2. Edit the field code so you end up with:
{ MERGEFIELD DocNumber \# "'DO'0000" }
3. Press F9 to update the field.
Done.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 06-09-2019, 11:01 PM
boonlailee boonlailee is offline Mergefield - Replace Prefix of Document Number Windows 10 Mergefield - Replace Prefix of Document Number Office 2019
Novice
Mergefield - Replace Prefix of Document Number
 
Join Date: Jun 2019
Posts: 6
boonlailee is on a distinguished road
Default

Hi Paul, thanks for your reply.

I tried as per your suggestion, here is what amended:
{ MERGEFIELD DocNumber \# "'DO-'0000" }

however, the result was still not as desired.

By the way, below the original, just in case this will help to indicate what goes wrong.
{ MERGEFIELD DocNumber \* MERGEFORMAT }

Hope you can help again.
Thanks.

Boon Lai
Reply With Quote
  #4  
Old 06-09-2019, 11:04 PM
macropod's Avatar
macropod macropod is offline Mergefield - Replace Prefix of Document Number Windows 7 64bit Mergefield - Replace Prefix of Document Number Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,577
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Delete the '-'. You can also ditch the '\* MERGEFORMAT' switch.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 06-10-2019, 04:08 AM
gmayor's Avatar
gmayor gmayor is online now Mergefield - Replace Prefix of Document Number Windows 10 Mergefield - Replace Prefix of Document Number Office 2016
Expert
 
Join Date: Aug 2014
Posts: 2,946
gmayor is just really nicegmayor is just really nicegmayor is just really nicegmayor is just really nice
Default

Or keep the hyphen and use
DO-{ MERGEFIELD "DocNumber" \# "0000"}
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 06-10-2019, 06:17 AM
boonlailee boonlailee is offline Mergefield - Replace Prefix of Document Number Windows 10 Mergefield - Replace Prefix of Document Number Office 2019
Novice
Mergefield - Replace Prefix of Document Number
 
Join Date: Jun 2019
Posts: 6
boonlailee is on a distinguished road
Default

Hi, thank you for your suggestions.
I tried all of your suggestion, but still did not get what i desired.

Let me show you the result i get so far,

1. Original Result before any amendment: INV-0001
2. Result after amendment as per Paul: INV-0001
3. Result after amendment as per Graham: DO-INV-0001

Hope you can help to identify where goes wrong please.
thanks again.

Boon Lai
Reply With Quote
  #7  
Old 06-10-2019, 04:32 PM
macropod's Avatar
macropod macropod is offline Mergefield - Replace Prefix of Document Number Windows 7 64bit Mergefield - Replace Prefix of Document Number Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,577
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Quote:
Originally Posted by boonlailee View Post
Let me show you the result i get so far,

1. Original Result before any amendment: INV-0001
2. Result after amendment as per Paul: INV-0001
3. Result after amendment as per Graham: DO-INV-0001
Either approach, done correctly, will generate DO-0001. I can only conclude you haven't followed the instructions. Without actually seeing the problem mailmerge main document, it can be difficult for anyone to diagnose the issue. Can you attach the mailmerge main document to a post (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #8  
Old 06-10-2019, 05:45 PM
boonlailee boonlailee is offline Mergefield - Replace Prefix of Document Number Windows 10 Mergefield - Replace Prefix of Document Number Office 2019
Novice
Mergefield - Replace Prefix of Document Number
 
Join Date: Jun 2019
Posts: 6
boonlailee is on a distinguished road
Default

Hi Paul,

thanks for your feedback, refer the attached.

Page 1:
Highlighted in Yellow, this is the original Invoice No based on <<DocNumber>> and required NO transformation. the result is INV-0001 (this one is totally fine).

Page 2:
Highlighted in Green, this is the DO No, to be based on <<DocNumber>> which required transformation we discussed above, the expected result should be DO-0001
and have yet to get the desired outcome.

Thanks again.
Boon Lai
Attached Files
File Type: docx PO_HuxleyFormat_v9_MsForum.docx (126.0 KB, 2 views)
Reply With Quote
  #9  
Old 06-10-2019, 06:23 PM
macropod's Avatar
macropod macropod is offline Mergefield - Replace Prefix of Document Number Windows 7 64bit Mergefield - Replace Prefix of Document Number Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,577
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

You're using Graham's version of the field, which should work just fine. Did you in fact refresh the field display as I advised in post #2 and are you actually completing the merge?
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #10  
Old 06-10-2019, 07:41 PM
boonlailee boonlailee is offline Mergefield - Replace Prefix of Document Number Windows 10 Mergefield - Replace Prefix of Document Number Office 2019
Novice
Mergefield - Replace Prefix of Document Number
 
Join Date: Jun 2019
Posts: 6
boonlailee is on a distinguished road
Default

Hi Paul,

Yes, i did completing the merge by right-click > Update Field.
done this with suggestion from both of you.

What could be the issue?

Thanks.
Boon Lai
Reply With Quote
  #11  
Old 06-10-2019, 08:03 PM
macropod's Avatar
macropod macropod is offline Mergefield - Replace Prefix of Document Number Windows 7 64bit Mergefield - Replace Prefix of Document Number Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,577
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Try completing the merge. Updating fields doesn't do that.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #12  
Old 06-10-2019, 08:48 PM
gmayor's Avatar
gmayor gmayor is online now Mergefield - Replace Prefix of Document Number Windows 10 Mergefield - Replace Prefix of Document Number Office 2016
Expert
 
Join Date: Aug 2014
Posts: 2,946
gmayor is just really nicegmayor is just really nicegmayor is just really nicegmayor is just really nice
Default

If the data contains INV-0001 (or INV-1) then the switch \# "0000" will produce
-0001. You can add INV or DO to this, as a prefix, as appropriate.

DO{ MERGEFIELD DocNumber \#"0000" }
or
INV{ MERGEFIELD DocNumber \#"0000" }
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #13  
Old 06-13-2019, 10:02 AM
boonlailee boonlailee is offline Mergefield - Replace Prefix of Document Number Windows 10 Mergefield - Replace Prefix of Document Number Office 2019
Novice
Mergefield - Replace Prefix of Document Number
 
Join Date: Jun 2019
Posts: 6
boonlailee is on a distinguished road
Default

HI, I been continued to try all method suggested, however not getting what i desired.

Thanks.
Reply With Quote
  #14  
Old 06-13-2019, 04:38 PM
macropod's Avatar
macropod macropod is offline Mergefield - Replace Prefix of Document Number Windows 7 64bit Mergefield - Replace Prefix of Document Number Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,577
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

If so, one wonders whether you're actually doing a mailmerge.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Tags
merge field, merge fields

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula to populate column with text prefix then next number (ascending) SerenityNetworks Excel 4 02-05-2019 07:22 AM
Mergefield - Replace Prefix of Document Number Replace characters in mergefield tommatwalker Mail Merge 6 07-17-2018 12:30 AM
Find entries lacking prefix and then add prefix. gsteel Excel 2 08-28-2017 11:36 AM
Mergefield - Replace Prefix of Document Number Word 2007 TOC Section Number w/Alpha Prefix? Gwen Butler Office 2 09-29-2011 06:10 AM
Mergefield - Replace Prefix of Document Number Find & Replace words with "/" prefix & suffix tollanarama Word 4 01-25-2011 02:19 AM


All times are GMT -7. The time now is 01:37 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft