+ Reply to Thread
Results 1 to 4 of 4

Formula or Macro for adding hyphen after 5 digits

  1. #1
    Registered User
    Join Date
    10-20-2015
    Location
    Alabama
    MS-Off Ver
    Excel 2013
    Posts
    29

    Question Formula or Macro for adding hyphen after 5 digits

    I have numerous product numbers in a single column that need a hyphen inserted after every five digits or letters. I searched google for an answer but couldn't find anything relevant to my need.

    Here's an example of what I have:
    7T98790005
    F78G1390G8

    and what I want:
    7T987-90005
    F78G1-390G8

    Thanks.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula or Macro for adding hyphen after 5 digits

    Hi,

    One way

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Formula or Macro for adding hyphen after 5 digits

    This might work for you. I don't know if all the data is 10 characters long so this should handle all lengths of data greater than 5 characters.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Formula or Macro for adding hyphen after 5 digits

    Or

    Row\Col
    A
    B
    C
    1
    7T98790005 7T987-90005 B1: =REPLACE(A1, 6, 0, "-")
    2
    F78G1390G8 F78G1-390G8
    Entia non sunt multiplicanda sine necessitate

+ 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. [SOLVED] Looking for a formula to count single digits vs. double digits?
    By mnlaw in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-29-2023, 02:20 PM
  2. Replies: 7
    Last Post: 07-27-2015, 06:14 AM
  3. dont understand hyphen hyphen
    By pg300 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-30-2014, 12:42 AM
  4. Macro to remove hyphen from number
    By AZJimBird in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2013, 03:19 AM
  5. Macro that will add a formula to a column of digits.
    By tonylyx in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2012, 06:42 PM
  6. [SOLVED] Adding a hyphen and keeping all digits
    By norm01 in forum Excel General
    Replies: 2
    Last Post: 05-01-2012, 05:40 PM
  7. Formula or a macro to return the first three digits of a number
    By westonkw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2008, 03:54 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