Results 1 to 8 of 8

Manipulating strings

Threaded View

pranks91 Manipulating strings 12-21-2016, 06:44 PM
mehmetcik Re: Manipulating strings 12-21-2016, 07:28 PM
pranks91 Re: Manipulating strings 12-21-2016, 07:50 PM
José Augusto Re: Manipulating strings 12-21-2016, 09:25 PM
mehmetcik Re: Manipulating strings 12-22-2016, 12:19 AM
pranks91 Re: Manipulating strings 12-22-2016, 05:15 AM
José Augusto Re: Manipulating strings 12-22-2016, 07:12 AM
mehmetcik Re: Manipulating strings 12-22-2016, 08:25 AM
  1. #4
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Manipulating strings

    Hi
    You can try this approach with this code in a module
    Option Explicit
    
    Function ExpandStr_Col(ByVal rng As Range, col As Integer) As Variant
    
    On Error Resume Next
    
        Dim s As String, f As String, r As String
        Dim i As Integer, j As Integer, k As Integer, m As Integer, w As Integer
        
        s = rng.Value: k = 1: f = ""
        Do
            i = InStr(k, s, "("): r = Mid(s, k, i - k): j = InStr(i + 1, s, ")")
            f = f & r & "("
            For m = i + 1 To j
                If Mid(s, m, 1) = "," Then f = f & ")," & r & "(" Else f = f & Mid(s, m, 1)
            Next m
            If m < Len(s) Then f = f & ","
            k = m + 1
        Loop Until k >= Len(s)
        w = Len(s) - Len(Replace(s, ",", "")) + 1
        For i = w To col: f = f & ",": Next i
        
        ExpandStr_Col = Split(f, ",")
        
    End Function

    and using a array formula (need to be enter with Ctrl+Shift+Enter)
    Select C2:Q2 and use this formula
    Formula: copy to clipboard
    =ExpandStr_Col(A2,15)

    where 15 is the maximum length of the array. (you can change that)
    Select C2:Q2 and copy down

    See the file
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Manipulating Strings in VB
    By hvincent in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2014, 01:36 PM
  2. Manipulating strings in VBA
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-27-2010, 01:36 PM
  3. Manipulating strings
    By therealjag in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2010, 08:32 AM
  4. Manipulating Text strings
    By xmoore in forum Excel General
    Replies: 13
    Last Post: 01-15-2010, 07:16 AM
  5. Manipulating Strings
    By OlYeller21 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-06-2009, 02:08 PM
  6. Manipulating strings in two columns
    By osalcido in forum Excel General
    Replies: 2
    Last Post: 03-05-2007, 08:41 PM
  7. [SOLVED] Manipulating Strings
    By Leslie Coover in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2005, 02:05 AM

Tags for this Thread

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