+ Reply to Thread
Results 1 to 8 of 8

Insert hyphen/dash in the middle of numbers

  1. #1
    Registered User
    Join Date
    04-02-2012
    Location
    swe
    MS-Off Ver
    Excel 2003
    Posts
    3

    Insert hyphen/dash in the middle of numbers

    Hello

    I am aware of this question being asked before but I have not been able to solve it with the past responses as I am too big of a rookie on excel.

    I several rows of information that I would like to insert a hyphen within after the fifth letter/digit. Every row starts with 1 letter and is then followed by 10 digits and looks like "M3858730131". The information is currently located in B2-B964.

    I would like to permanently insert a hyphen after the fifth digit and not just format it so it looks good in excel.

    Is this solvable only with VBA or some other method? If VBA is the only possibility I could use some guidance there on how to use it as well

    Thanks in advance!

    Best regards,
    noxious

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Insert hyphen/dash in the middle of numbers

    Hi,

    =REPLACE(A1,6,,"-")

    Edit: sorry - just saw you posted in the VBA forum.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    04-02-2012
    Location
    swe
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Insert hyphen/dash in the middle of numbers

    Thank you, but how do I make use of this function? Where do i put it to make it affect all rows?

    Cheers

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Insert hyphen/dash in the middle of numbers

    VBA?
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Insert hyphen/dash in the middle of numbers

    Maybe:

    Please Login or Register  to view this content.
    Or?

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Insert hyphen/dash in the middle of numbers

    Maybe:

    Please Login or Register  to view this content.
    Or?

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-02-2012
    Location
    swe
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Insert hyphen/dash in the middle of numbers

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    Or?

    Please Login or Register  to view this content.
    Works flawless. Thank you very much!

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Insert hyphen/dash in the middle of numbers

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Insert hyphen/dash in the middle of numbers

    You're welcome. Glad to help out and thanks for the feedback.

  10. #10
    Registered User
    Join Date
    10-30-2014
    Location
    Boston, MA
    MS-Off Ver
    207
    Posts
    1

    Re: Insert hyphen/dash in the middle of numbers

    How can I delete a hyphen using this sub test VBA

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dash or Hyphen Automatically Adds Space in VBA code
    By noodle88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2014, 11:46 PM
  2. Replies: 5
    Last Post: 04-26-2013, 08:32 PM
  3. [SOLVED] Need to insert character (dash) between part numbers
    By BYizz in forum Excel General
    Replies: 3
    Last Post: 10-04-2012, 02:21 PM
  4. How to insert hyphen "-" in between two numbers
    By Big Cat in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-06-2006, 02:25 PM
  5. [SOLVED] How to insert a repeating dash in phone numbers without dashes in.
    By LemonLiptonTea in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 02-05-2005, 02:06 PM

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