+ Reply to Thread
Results 1 to 6 of 6

Numeric switch to truncate and replace on right side of number

Hybrid View

  1. #1
    Registered User
    Join Date
    07-26-2011
    Location
    Rensselaer, New York
    MS-Off Ver
    Excel 365 Business
    Posts
    28

    Numeric switch to truncate and replace on right side of number

    I'm generating some labels to track some parts in my facility. The layout is simple. All refrer to a master drawing, for example 12345100. The individual parts are labeled 12345101, 12345102 and so on. What is the numeric switch to cut off the last two digits and replace with an 01, 02, 03 and so on?

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,835

    Re: Numeric switch to truncate and replace on right side of number

    Assuming you're working with fields, you'd need to embed the exisiting field in a formula field, coded as:
    {=MOD('label field',100)}
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    07-26-2011
    Location
    Rensselaer, New York
    MS-Off Ver
    Excel 365 Business
    Posts
    28

    Re: Numeric switch to truncate and replace on right side of number

    Hey thanks a lot. It had some function but I'm definitely having some problem with the syntax. Are there any pointers you could give me? I'm very new to fields...more of an excel and that's a stretch still.

    Thanks.

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,835

    Re: Numeric switch to truncate and replace on right side of number

    Perhaps I've missed something. Are you trying to extract just the last two digits, or replace them with something else? Also, is this a label mailmerge?

  5. #5
    Registered User
    Join Date
    07-26-2011
    Location
    Rensselaer, New York
    MS-Off Ver
    Excel 365 Business
    Posts
    28

    Re: Numeric switch to truncate and replace on right side of number

    I'm actually trying to keep only the first six digits and modify the last 2. Yes, this is a label mail merge to answer your question. The main number (49401100) is a main drawing and the numerical label for the enire set, while the subsequent numbers (49401101-49401105) are individual drawings related to the first.

  6. #6
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,835

    Re: Numeric switch to truncate and replace on right side of number

    OK, given that it's a mailmerge, your mergefield probably looks something like:
    «DrawingID»

    To eliminate the last two digits:
    • select the «DrawingID» mergefield in the first label and press Ctrl-F9 to create a pair of field braces. You should see: { «DrawingID» }
    • edit the field contents so that you end up with {=INT(«DrawingID»/100)} (note that this is different to what I suggested previously).
    • select the entire field and press Ctrl-F9 again, so that you end up with {{=INT(«DrawingID»/100)} }
    • edit the field contents so that you end up with {QUOTE"{=INT(«DrawingID»/100)} }
    • between the last pair of field braces press Ctrl-F9 twice more, so that you end up with {QUOTE"{=INT(«DrawingID»/100)}{ { } } }
    • edit the field contents so that you end up with {QUOTE"{=INT(«DrawingID»/100)}{=MOD({MERGESEQ},100) \# 00}"}
    • press F9 to update the field display.
    • update the remaining labels
    • run the mailmerge

    Note: The field brace pairs (ie '{ }') can't be typed or copied & pasted from this message. Likewise, you can't type or copy & paste the chevrons (ie '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar. If you mess up and need to edit the field code, press Alt-F9 to toggle the field display. This will change the «DrawingID» to {MERGEFIELD DrawingID}, but that's of no consequence.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1