+ Reply to Thread
Results 1 to 14 of 14

Add text to a cell that already contains text based on if another cell contains a word

  1. #1
    Registered User
    Join Date
    01-15-2021
    Location
    Lindon, UT
    MS-Off Ver
    2019
    Posts
    12

    Post Add text to a cell that already contains text based on if another cell contains a word

    I need a macro that will add the text ",Convenient" to a cell that already contains other text in column B if a cell in column A contains the word "mobile". The word "mobile" could be upper or lower case. Also, the text ",Convenient" would be appended to the end of the already existing text in that cell; example: "Auto,Convenient". I may have up to 50,000 rows to check and so it will loop. Skip any row that doesn't contain the word "mobile" in column A. Here's an example of the spreadsheet before and after:

    Before:

    A B
    ABC Car Wash Auto
    Cleanz Mobile Detailing Auto
    Mobile Oil Change Bros Auto
    Jacks Car Repair Auto
    Jim's Dent Repair mobile Auto

    AFTER:

    A B
    ABC Car Wash Auto
    Cleanz Mobile Detailing Auto,Convenient
    Mobile Oil Change Bros Auto,Convenient
    Jacks Car Repair Auto
    Jim's Dent Repair mobile Auto,Convenient

    Thank you kindly for your help!

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,229

    Re: Add text to a cell that already contains text based on if another cell contains a word

    How about
    Please Login or Register  to view this content.

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,947

    Re: Add text to a cell that already contains text based on if another cell contains a word

    Oops! I see Fluff beat me to it.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,428

    Re: Add text to a cell that already contains text based on if another cell contains a word

    Question: Is it possible for the word "mobile" to be in a cell in Column A and the adjacent cell in Column B be blank? If so, should the cell in Column B remain blank or have the single work "Convenient" be placed in it all by itself?

  5. #5
    Registered User
    Join Date
    01-15-2021
    Location
    Lindon, UT
    MS-Off Ver
    2019
    Posts
    12

    Re: Add text to a cell that already contains text based on if another cell contains a word

    If the cell in column B is blank then we want to add "Convenient" without the ",".

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,229

    Re: Add text to a cell that already contains text based on if another cell contains a word

    In that case, how about
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-15-2021
    Location
    Lindon, UT
    MS-Off Ver
    2019
    Posts
    12

    Re: Add text to a cell that already contains text based on if another cell contains a word

    Hi Fluff13,

    The macro didn't work for me. My current spreadsheet is looking for "mobile" in column A and needs to put ",Convenient" in column AB. Please advise.

    Thank you!

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,229

    Re: Add text to a cell that already contains text based on if another cell contains a word

    It's always best not to simplify your needs, otherwise you get something that doesn't work.
    How about
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    01-15-2021
    Location
    Lindon, UT
    MS-Off Ver
    2019
    Posts
    12

    Re: Add text to a cell that already contains text based on if another cell contains a word

    Thanks for the advice . That worked! Now, if for some reason I needed to run the macro twice (its one of many macros being run at the same time and I do run it twice in some cases) and I wanted to prevent it from adding ",Convenient" a second time, how would I need to alter the code? Thanks again for all your help!

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,229

    Re: Add text to a cell that already contains text based on if another cell contains a word

    Any other requirements?

  11. #11
    Registered User
    Join Date
    01-15-2021
    Location
    Lindon, UT
    MS-Off Ver
    2019
    Posts
    12

    Re: Add text to a cell that already contains text based on if another cell contains a word

    Nope, that's the last one.

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,229

    Re: Add text to a cell that already contains text based on if another cell contains a word

    In that case try
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    01-15-2021
    Location
    Lindon, UT
    MS-Off Ver
    2019
    Posts
    12

    Re: Add text to a cell that already contains text based on if another cell contains a word

    Thank you Fluff13 I really appreciate the help. That worked perfectly.

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,229

    Re: Add text to a cell that already contains text based on if another cell contains a word

    You're welcome & thanks for the feedback.

+ 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. Replies: 1
    Last Post: 08-10-2020, 05:43 PM
  2. [SOLVED] Excel to Word: Select only Word cell's text and not the cell range
    By Menohavename in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-31-2020, 05:01 PM
  3. Automatically change text on cell based on text on other cell
    By Pranav Menon in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-09-2019, 10:07 AM
  4. [SOLVED] Adding text to a cell based on specific text characters in another cell
    By JohnnyBoyxxx in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-29-2014, 06:03 PM
  5. Change the colour of single word in text string based on another cell value
    By joshnathan in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-03-2014, 09:41 AM
  6. [SOLVED] Delete word based on cell text
    By scruz9 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2014, 05:54 PM
  7. Replies: 2
    Last Post: 11-29-2012, 11:27 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