+ Reply to Thread
Results 1 to 8 of 8

Manipulating strings

  1. #1
    Registered User
    Join Date
    12-21-2016
    Location
    London
    MS-Off Ver
    2016 Professional
    Posts
    3

    Manipulating strings

    Hello,

    I want to manipulate strings of text/numbers. See attached my spreadsheet.

    If part of the string has one number in parentheses e.g. A(1), that can be left as it is. For parts with more than one number e.g. F(1,100,200), I want this broken down into F(1),F(100),F(200).

    The "Original" is my string currently and "New" is what I want it to finish as.

    I have hundreds of such strings so it cannot be done manually. Any suggestions/assistance will be appreciated.

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Manipulating strings

    Put this Code into a Macro module:

    Please Login or Register  to view this content.

    Then this formula will do what you want:=

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 12-21-2016 at 07:30 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    12-21-2016
    Location
    London
    MS-Off Ver
    2016 Professional
    Posts
    3

    Re: Manipulating strings

    Thanks. Using the code, how could I convert the string text into columns?

  4. #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
    Please Login or Register  to view this content.

    and using a array formula (need to be enter with Ctrl+Shift+Enter)
    Select C2:Q2 and use this formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    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

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Manipulating strings

    You would need a Macro like this:-

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-21-2016
    Location
    London
    MS-Off Ver
    2016 Professional
    Posts
    3

    Re: Manipulating strings

    Thank you both for your help.

    I have noticed that some of my strings do not include any parentheses at all e.g. A(1),BA(1),C1(1,100),D1A(10),E(1),F(1,100,200),G(1),H,J,K,L,M

    Using the code in the first spreadsheet, such a string returned a #VALUE! error and in the second spreadsheet my Excel crashed. Could you assist in modifying the code to incorporate such instances?
    Attached Files Attached Files

  7. #7
    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
    Use in C2 this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to expand the string to your desired format and then use in D2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and copy right to perform Text to columns.

    See the file
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Manipulating strings

    Please Login or Register  to view this content.

+ 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] 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. 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