+ Reply to Thread
Results 1 to 19 of 19

Mass Replace words from strings

  1. #1
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Mass Replace words from strings

    Hello, I have found this sample that I have attached here that seems to do what I am looking for, but I am unable to change the Array nor copy and paste down.
    How is that done?

    In column A is the original data. I need to be able to change/replace words in column A all the way down to about 5K rows

    In Column B are the words I want to remove,
    in column C I would input replacement words, or leave it Blank if no none are required
    In column D would be the Final output as wished.

    How can I change the current array to perform the task for all the data in column A?

    In the current status it only works for the first 9 Rows in column A and can only find whats written in the first 3 Rows of Column B.

    This is the code in the module of the attachment
    HTML Code: 
    Thank you for your input
    OP
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Mass Replace words from strings

    Hi there,

    No need to change anything in the code. You need to set the ranges/arrays when entering the formula first.

    Try the steps below:

    Clear all formulas in column D.

    In cell 'D2' enter the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Orange = the array where your original data is. So 6,000 should cover your 'about 5k.
    Blue = Array where the strings are you want to remove.
    Green = Array with the replacement strings.

    Blue and Green arrays should be the same length. The sample above is to row 20, so 19 strings. Change the figure as required.

    Once you have the correct range/arrays you need, pull down the formula (double click in the right-bottom corner of the field to 'auto-fill' to the last row.

    Let us know if that works.
    Last edited by ORoos; 04-22-2023 at 02:43 AM.
    If your Question is answered; please mark it SOLVED. If you are happy with a member's solution, say 'Thanks' and click the 'Star' to Add Reputation.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,299

    Re: Mass Replace words from strings

    In Column B are the words I want to remove,
    in column C I would input replacement words, or leave it Blank if no none are required
    In column D would be the Final output as wished.
    A different option...
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Re: Mass Replace words from strings

    Hi Sintek, Thank you very much, your code works wonderful magic and FAst.
    I just don't understand how to change the code to refer to different columns. Could you please let me know what I need to change in the code?
    for instance:
    Change you your code to a revised column positions:

    In column E is the source data
    In Column H are the words I want to remove,
    in column G I would input replacement words, or leave it Blank if no none are required
    In column K would be the Final output as wished.

    It would help me understand how to change columns in the code in the event I need to modify my template.

    Thank you Sintek
    Op

  5. #5
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Re: Mass Replace words from strings

    Hi Oroos, Unfortunately I am unable to make the formula work. Its not removing the words when i copy down the formula. The VBA code by Sintek works great, I just need to learn how to designate different columns.

    Thank you ORoos
    cheers
    Op

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,299

    Re: Mass Replace words from strings

    Change you your code to a revised column positions:
    This I will have to see...All depends on whether or not there are headings, blank columns etc...
    Please upload a small sample of actual file setup...

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,625

    Re: Mass Replace words from strings

    Here is the code for UDF
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

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

    Re: Mass Replace words from strings

    onp.

    I asked you twice in another recent thread to confirm that you're still using Excel 2019. You joined quite a while ago, so your profile may be out of date.

    Kindly confirm what you ARE using and update your profile (if required)... and don't continue to ignore me.
    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

  9. #9
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Re: Mass Replace words from strings

    Hi Glenn, Just checked and updated profile. Apologies if I inadvertently ignored your question. I do normally answer all questions
    Cheers
    Op

  10. #10
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Re: Mass Replace words from strings

    Hi kvsrinivasamurthy, thank you for your response.

    I have tested the code on all the data I need to replace words with, but not working quite well.
    Basically it is replacing just a few of the words listed in column B "Find What? Eventually there will be more words in that "Replace what" List.

    However, if I add an additional column (E) and replace words from the already replaced words result in column D
    and add Column (F) to replace words from Column E all the words in the list will eventually be replaced. - See new Sample.

    This makes me add too many columns in order to replace all the listed words.
    As I review the data to verify the results I realize that there are other issues that I will need to resolve
    such as duplicate words (A26) within the string. So not sure if the remove duplicate could be implemented to the UDF.

    Thank you so much for your help
    Cheers
    OP
    Attached Files Attached Files

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,299

    Re: Mass Replace words from strings

    Hi Sintek, Thank you very much, your code works wonderful magic and FAst.
    And...response to Post 6

  12. #12
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Re: Mass Replace words from strings

    Hi SIntek I am preparing the Actual file for you as I type. Will be posted in a few min. Hope it will not give you a headache

  13. #13
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,299

    Re: Mass Replace words from strings

    Have "loadshedding" for the next 2 - 4 hours so can only check in again later...

  14. #14
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Re: Mass Replace words from strings

    Here it is Sintek.

    Only row 55 has actual formulas. Just to keep file size Small. You can copy down if needed.
    Column BM to CJ is where I filter the words from The actual Statement Data (Pasted in Column E)
    with various and way too many formulas.

    Such, beside Confusing me when I have to trace a problem in a formula result and the computer Smoking when the rows reach well above 5000,
    And especially when real-time data that is constantly updating (Witch it needs to be) Is A nightmare.

    So the idea was rather than using all of the formulas to find the needed Numbers and or words,
    I thought by Replacing and/or removing words/symbols/numbers/duplicates within the string From Column E and Placing the new filtered string into a new column,
    such would allow me to really get rid of lots of formulas and headaches and hence make things faster.
    But because of lack of commitment in where the column and range of the filter data will end up, I will need to change such definitions accordingly.

    Hope its not confusing
    Cheers Sintek and a big thank you
    OP

    P.S. If you Get #Value and #N/A thats where the formula is trying to retrieve the real-time data. In my case Thinkorswimm platform.
    Attached Files Attached Files

  15. #15
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,625

    Re: Mass Replace words from strings

    UDF code. This will remove all the words in "Find what" Range (Column B).
    Please Login or Register  to view this content.
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Re: Mass Replace words from strings

    I don't know Ans...But its looking rel good don't want to get exited yet. Still testing it on all of my data. Will report back soon

  17. #17
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,299

    Re: Mass Replace words from strings

    Hope its not confusing
    Has no bearing whatsoever to your post 4 requirement...

  18. #18
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Re: Mass Replace words from strings

    YES!!! Ans, it works fantastically, cant thank you enough for your help it really makes my hair pulling come to an end
    Thank you so much Ans

    Cheers
    All the best
    OP

  19. #19
    Forum Contributor
    Join Date
    01-25-2014
    Location
    Italy - Currently In USA
    MS-Off Ver
    Excel 2019
    Posts
    207

    Re: Mass Replace words from strings

    Just wanted to thank all for your time and the help you have provided. kvsrinivasamurthy found the solution I was looking for. I shall mark the thread as Solved.
    I love this Forum
    CHeers to all
    OP

+ 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. localize strings w lookup function in mass data dump
    By araza123 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-27-2021, 02:50 AM
  2. [SOLVED] Bulk Find and Replace Whole Words, Not Strings
    By sweetrevelation in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2013, 04:28 PM
  3. [SOLVED] Excel 2007 : Mass Find and Replace
    By kikokazuma in forum Excel General
    Replies: 4
    Last Post: 04-30-2012, 08:43 AM
  4. Replies: 3
    Last Post: 02-27-2012, 05:39 PM
  5. Mass Replace Anywhere
    By tacobelldog52 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2011, 01:04 PM
  6. Mass find and replace
    By Watoth in forum Excel General
    Replies: 1
    Last Post: 11-01-2010, 02:09 PM
  7. Mass find and replace
    By coletteno1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-17-2010, 07:27 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