+ Reply to Thread
Results 1 to 25 of 25

Split Text Across Multiple Columns and Add Additional Text

  1. #1
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Split Text Across Multiple Columns and Add Additional Text

    Hello again. I'm fine tuning my line of questioning over the last few posts I've made...think I have it narrowed down to what I'm trying to do. I'm looking to take a string of text, split it across multiple columns, and insert additional text at certain points. Example of string:
    FLG 1-1/2" 300 316 RF BLD
    The separation would go as follows with the added text in parentheses:
    FLG 1-1/2" 300(#) 316(SS) RF BLD
    The idea would be to do this via macro. Anyone know of a way to go about this? It would be greatly appreciated. Apologies for the lack of workbook...I only have a phone at the moment.

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Split Text Across Multiple Columns and Add Additional Text

    Attach a sample workbook (with more than one sample), showing your expected output for that sample.

    Go Advanced -> Manage Attachments -> Upload

  3. #3
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    Will do...as soon as I have pc access.

  4. #4
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: Split Text Across Multiple Columns and Add Additional Text

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Split Text Across Multiple Columns and Add Additional Text

    Or a slower version maybe
    As per your example.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    Have a computer now...let me try this again. Workbook attached. I'm looking to take a string of text, split it across multiple columns, and insert additional text at certain points. Example of string:
    FLG 1-1/2" 300 316 RF BLD
    The separation would go as follows with the text that needs to be added in parentheses:
    FLG 1-1/2" 300(#) 316(SS) RF BLD
    The idea would be to do this via macro. I tried the ones above but they don't seem to be quite what I'm after, however the effort is much appreciated. The attached workbook is laid out as follows: Column D= A combination of columns R & S. This would be the column that needs splitting up. If you scroll over to Column T you will see that I did the "Text to Columns" function to do exactly that. This is probably the closest I've gotten to what I'm trying to achieve. Where it's still falling short is that these are abbreviated descriptions and I need to "un-abbreviate" them and place the information in columns G:O. So something like RFWN would need to become Raised Face Weld Neck. Which can be done through substitution, but there's a lot of information and a lot of steps. The other thing is numbers like 600, 900, 1500 all need a # sign after them. And numbers like 316 or 347 need SS after them. So there are a lot of different things that need to be done and I'm trying to figure out the best way to do it. The Substitute function works great, the Text to Column feature works great. I'm just looking for a way to combine the steps, and fill in the blanks. Confused Yet? Thanks to anyone willing to help.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    Clarifying request after alot of searching/ trial and error: A macro that can split a text string into multiple columns, substitute portions of text, add suffix to portions of text. Anyone have that lying around in their back pocket somewhere? You'd be my hero.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Split Text Across Multiple Columns and Add Additional Text

    Can you just upload a sample workbook with a small amount of data and the result that you want clearly showing the logic behind it?
    Of course the data should be consist of variety of possible different patterns.

    I'll be busy today, so reply will be late.

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Split Text Across Multiple Columns and Add Additional Text

    Re: A macro that can split a text string into multiple columns.
    Following would do that.
    Please Login or Register  to view this content.
    How do you apply the logic from your example (FLG 1-1/2" 300 316 RF BLD -----> FLG 1-1/2" 300# 316SS RF BLD) to, for instance, these?
    BLD-FLG B16.5 1 1/2" 300 RF
    1, 600, RFWN, F316/L SCHXXS
    1/2, 600, RFWN, 347 SCH160

    I am convinced that someone, certainly jindon, will come up with a solution but in the meantime we can play with it to see what we can arrange.

  10. #10
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    Okay. I managed to get a workbook updated. scroll down to row 100 and you'll find a short description that hopefully answers a lot of questions, as well as some code that might prove useful. Please let me know if anything further is needed. Thanks to everyone for their help. Also, attached workbook might be in 2007 and the original was in 2010. My computer situation at the moment needs improvement to say the least. Thanks again.
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Split Text Across Multiple Columns and Add Additional Text

    Column D split into Column G and on
    Please Login or Register  to view this content.
    How would you determine if a value of for instance 550 would get SS or # as suffix?

  12. #12
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    Going to answer this as best I can. The # sign. It applies to the flange Class/Rating. If memory serves me those numbers should be 150,300,600,900,1500,2500 and nothing else. The SS suffix applies to certain Materials. Those numbers should be 316,310,304,317 & 321. Where it gets confusing is there is 316/L,304H,F316/L, etc...the SS does not apply to those. Hopefully that helps clarify the suffix portion a little. Let me know if anything further is needed. Thanks for the help.

  13. #13
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    One of the issues that I'm running into that is noticable when the text is transferred to columns is that it's all inconsistent. One column may have data for Flange type, Material, Class/Rating, & Schedule. That's because each row of data was entered differently originally. But the goal is to separate them,ie; Material in one column, Flame Type in one column, Size on one column,etc.

  14. #14
    Registered User
    Join Date
    08-12-2018
    Location
    India
    MS-Off Ver
    using 2007 and 2010
    Posts
    2

    Re: Split Text Across Multiple Columns and Add Additional Text

    Hi

    I want a userform to filter following items from the list. please help me. this is my first thread so please help.
    all the comboboxes (Dynamic) should be related to each other. and results as filtered data should reflect in listbox.

    Fields
    KFI Operator
    Verify Operator
    KFI Error
    Verify Error

    and the table is as below:

    I have 16 columns:

    Fields is in column 5
    KFI Opt is in 9
    Verify Opt is in 10
    KFI Error is in 13
    Verify Error is in 14.


    Thanks,
    Umesh

  15. #15
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,705

    Re: Split Text Across Multiple Columns and Add Additional Text

    chandrau03, your question is not related to this thread.

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Split Text Across Multiple Columns and Add Additional Text

    Jim Clayton,

    Thanks for the workbook, but I need to see some of ACTUAL data in col.G:O, so that we can test result of the code with the actual result that you need.

  17. #17
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    Revised workbook per request. Columns E and G:O are the ones in question. I've updated the information as accurately as possible. Hopefully this gives you a better idea of what I'm talking about and also the challenges ahead. Thanks again for all the help.
    Attached Files Attached Files

  18. #18
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Split Text Across Multiple Columns and Add Additional Text

    I just got the logic for Col.G to J.

    I don't understand the logic for the rest.
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    You and me both... seriously I appreciate all the help. I wasn't anticipating a solution that got me 100% of the way there. If the above can knock out some of the steps and I can combine it with something else and spend 10 minutes on it when I'm updating it rather than the excessive amount of time I was spending before, that works for me. The problem is that alot of the data is hard to justify. It makes sense to me because I look at it every day. But, I digress. Thanks for all the help and time spent on this.

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Split Text Across Multiple Columns and Add Additional Text

    You are welcome.

    If you upload a workbook with the data with the lines that the code doesn't pic up the correct data in each column, it may be solved 100%.
    So, presenting all the possible different pattern of data and the correct data in each column is very important, and they should not be more than 50 records.
    Last edited by jindon; 08-19-2018 at 01:04 AM.

  21. #21
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    Alright, I've got two workbooks for you. The first one is to hopefully help clarify a lot of the questions and inconsistencies and the second is as you requested...pretty sure that's what you were asking for. For the most part the code looks like it's working really well with only minor gaps here and there. It's light years beyond anything I'm capable of. Very much appreciated. Thanks.
    Attached Files Attached Files

  22. #22
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Split Text Across Multiple Columns and Add Additional Text

    I just don't know where "Item Number" come from.
    Please Login or Register  to view this content.
    Last edited by jindon; 08-19-2018 at 03:52 AM.

  23. #23
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    The Item Number is auto generated from a report into a separate column and is not part of the description. The Description is what I'm trying to split. Why it's confusing is that there is Material, Item Number, Size, and the middle one has nothing to do with the other two. Unfortunately it has to be structured this way for steps that will take place further along in the process. It's essentially just jumping a column. Hopefully that helps. Thanks again.

  24. #24
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Split Text Across Multiple Columns and Add Additional Text

    If that takes care of your original question, select Thread Tools from the menu link above and mark this thread as SOLVED.

  25. #25
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Split Text Across Multiple Columns and Add Additional Text

    Thanks again. Appreciate the help.

+ 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. Split Column text in multiple columns !
    By ionelz in forum Excel General
    Replies: 1
    Last Post: 11-25-2017, 09:37 AM
  2. [SOLVED] Text from one cell split into multiple columns
    By spiritcat in forum Excel General
    Replies: 3
    Last Post: 08-26-2014, 02:03 PM
  3. [SOLVED] Split Wrapped Text (Multiple Lines) in A Cell to Multiple Columns
    By csmiin in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-28-2012, 09:15 PM
  4. Parse Text, Split to New Row, Multiple Columns
    By msbaker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2010, 02:01 PM
  5. [SOLVED] How to input additional text to multiple of existing cells that has text
    By RagDyer in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 04:05 AM
  6. Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. Replies: 0
    Last Post: 09-05-2005, 10:05 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