+ Reply to Thread
Results 1 to 9 of 9

Display ABC12345 as ABC 1234 5

Hybrid View

jonas-martens Display ABC12345 as ABC 1234 5 10-04-2018, 07:30 AM
Sam Capricci Re: Display ABC12345 as ABC... 10-04-2018, 07:34 AM
jonas-martens Re: Display ABC12345 as ABC... 10-04-2018, 07:36 AM
Sam Capricci Re: Display ABC12345 as ABC... 10-04-2018, 07:43 AM
Glenn Kennedy Re: Display ABC12345 as ABC... 10-04-2018, 08:07 AM
jonas-martens Re: Display ABC12345 as ABC... 10-04-2018, 08:14 AM
AlKey Re: Display ABC12345 as ABC... 10-04-2018, 09:23 AM
jonas-martens Re: Display ABC12345 as ABC... 10-04-2018, 09:25 AM
CK76 Re: Display ABC12345 as ABC... 10-04-2018, 03:13 PM
  1. #1
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    109

    Display ABC12345 as ABC 1234 5

    Hi,

    Can't really find the correct format to display

    ABC12345 as ABC 1234 5

    So if I enter ABC12345, without any space character, Excel automatically displays ABC 1234 5.

    Thanks.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Display ABC12345 as ABC 1234 5

    if you want it done automatically and in the same cell you are probably going to need VBA. If you want it done by formula in another cell then this would work...
    =LEFT(A1,3)&" "&MID(A1,4,4)&" "&RIGHT(A1,1)
    it assumes all your data will be the same length
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    109

    Re: Display ABC12345 as ABC 1234 5

    Thanks Sabo kid.

    Got a suggestion how to do this using VBA?

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Display ABC12345 as ABC 1234 5

    Sorry, I don't have the VBA skills. someone might come along with them to help though asking a moderator to move this post to the VBA area of the forum could get you the help faster.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Display ABC12345 as ABC 1234 5

    Is the text ALWAYS ABC? Are there always 5 digits after it? Please provide a more representative selection of samples.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  6. #6
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    109

    Re: Display ABC12345 as ABC 1234 5

    Hi,

    Letters at front are not always the same.
    Always 6+1 numbers after it.
    My example was just random.

    Examples:
    CLXU 451155 7
    CLDU 969989 8
    FMBU 003078 2
    FMBU 003561 3
    CLDU 962708 8
    FMBU 008677 6

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Display ABC12345 as ABC 1234 5

    Try this
    Enter in B1 and copy down
    Formula: copy to clipboard
    =REPLACE( REPLACE(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&1/17)),," "),LEN(A1)+1,," ")

    v A B
    1 CLXU4511557 CLXU 451155 7
    2 CLDU9699898 CLDU 969989 8
    3 FMBU0030782 FMBU 003078 2
    4 FMBU0035613 FMBU 003561 3
    5 CLDU9627088 CLDU 962708 8
    6 FMBU0086776 FMBU 008677 6
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  8. #8
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    109

    Re: Display ABC12345 as ABC 1234 5

    Wow thanks AlKey!

  9. #9
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Display ABC12345 as ABC 1234 5

    Just as reference, sample vba solution.

    Sub Demo()
    Dim cel As Range
    Dim rng As Range
    Set rng = Selection 'Change as needed
    With CreateObject("VBScript.RegExp")
        .Global = True
        .Pattern = "([A-Z]*)(\d{6})(\d{1})"
        For Each cel In rng.Cells
            If .test(cel.Value) Then
                Set matches = .Execute(cel.Value)
                For i = 0 To 2
                   res = IIf(Len(res) = 0, matches(0).Submatches(i), res & " " & matches(0).Submatches(i))
                Next
                cel.Value = res
                res = ""
            End If
        Next
    End With
    End Sub
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

+ 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. If Value is >= X & <= Y, then $1234
    By Fattie in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 08-14-2008, 11:31 AM
  2. More on 1234,56 - another problem
    By Washington in forum Excel General
    Replies: 13
    Last Post: 04-26-2007, 01:34 PM
  3. how to change (555)123-1234 to 5551231234
    By buccig in forum Excel General
    Replies: 1
    Last Post: 02-07-2006, 04:10 PM
  4. RE: how to change (555)123-1234 to 5551231234
    By JMB in forum Excel General
    Replies: 0
    Last Post: 02-03-2006, 07:50 AM
  5. [SOLVED] Why when I enter 1234 do I see 12.34 in Excel ?
    By LARED in forum Excel General
    Replies: 2
    Last Post: 01-20-2006, 12:00 PM
  6. [SOLVED] make 1234 -&gt; 012034
    By Daniel M in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2005, 01:05 AM

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