+ Reply to Thread
Results 1 to 8 of 8

Insert multiple characters into string w LEFT RIGHT functions

  1. #1
    Registered User
    Join Date
    04-29-2014
    Location
    MN
    MS-Off Ver
    Excel 2010
    Posts
    3

    Insert multiple characters into string w LEFT RIGHT functions

    I've got a long list of account numbers of varying length and ultimately need to add a dash and a dot into these numbers.

    Here's an example

    12345678 to> 1-2345.678
    123456789 to> 12-3456.789
    1234567890 to> 123-4567.890

    The standard format is always 3 numbers after the . and 4 numbers between the - and .

    I can get to this by doing a series of functions starting with this:
    =LEFT(A1,LEN(A1)-3)&"."&RIGHT(A1,3) to get 12345.678 or 123456.789
    copy/pasting that value into another field and then doing this
    =LEFT(E1,LEN(E1)-8)&"-"&RIGHT(E1,8) to get the results above

    I can't quite figure out the format to combine the multiple steps/functions into one so that I'm not copy/pasting values and re-doing the function.

    I scoured the google and couldn't find something specifically related to this. Hope that was clear.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,194

    Re: Insert multiple characters into string w LEFT RIGHT functions

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



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: Insert multiple characters into string w LEFT RIGHT functions

    Maybe this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Never use Merged Cells in Excel

  4. #4
    Registered User
    Join Date
    04-29-2014
    Location
    MN
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Insert multiple characters into string w LEFT RIGHT functions

    TMS - That did it. Thanks for the speedy reply. I was pretty far from getting to that result during my tests.

    zbor - using your formula I got #-#.###

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,194

    Re: Insert multiple characters into string w LEFT RIGHT functions

    You're welcome.

    zbor's formula works just fine for me. It will, in fact, cope better with the shorter numbers ... I purposely cut off at 7 characters.


    Regards, TMS



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,194

    Re: Insert multiple characters into string w LEFT RIGHT functions

    Example attached ...
    Attached Files Attached Files

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: Insert multiple characters into string w LEFT RIGHT functions

    Oh, didn't consider ending at 0.
    Need to format it:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-29-2014
    Location
    MN
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Insert multiple characters into string w LEFT RIGHT functions

    That second suggestion did the trick zbor.

    Thanks both of you for the suggestions!

+ 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] Insert a zero on the left of a string?
    By dwest100 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-22-2014, 06:12 PM
  2. [SOLVED] find word in string, count how many special characters are to its left
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2013, 06:46 PM
  3. [SOLVED] Extract left characters from string with exception of 2 right characters
    By sweetkel23 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-16-2012, 10:45 PM
  4. Insert a decimal point 2 characters to the left
    By ClikClak in forum Excel General
    Replies: 2
    Last Post: 09-01-2010, 11:54 AM
  5. removing 4 characters from the left of a string
    By mfish2010 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2010, 07:16 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