+ Reply to Thread
Results 1 to 4 of 4

Need to insert character (dash) between part numbers

  1. #1
    Registered User
    Join Date
    10-04-2012
    Location
    Panama City, Florida
    MS-Off Ver
    Excel 2010
    Posts
    43

    Need to insert character (dash) between part numbers

    I need to have two columns of part numbers, one part number with a straight, unbroken 12-digit string (ie. 444455556666), and I need the other column to insert dashes between every fourth digit (i.e. 4444-5555-6666). I'm pretty sure this needs to be done with VBA, but I'm a bit rusty with VBA. I already have the initial column of unbroken digits, I just need to create a new column with the inserted dashes. Thanks in advance.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Need to insert character (dash) between part numbers

    hi BYizz, welcome to the forum. assuming your data is in A1, wont this work for you?
    =LEFT(A1,4)&"-"&MID(A1,5,4)&"-"&RIGHT(A1,4)

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Need to insert character (dash) between part numbers

    Alternate,
    Please Login or Register  to view this content.
    Or just fomat A1 with the custom format: "0000-0000-0000" (no quotes)
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    10-04-2012
    Location
    Panama City, Florida
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Need to insert character (dash) between part numbers

    Quote Originally Posted by benishiryo View Post
    hi BYizz, welcome to the forum. assuming your data is in A1, wont this work for you?
    =LEFT(A1,4)&"-"&MID(A1,5,4)&"-"&RIGHT(A1,4)

    This is what I ended up using; I just wasn't aware of the left mid and right text functions. Thanks!

+ 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