+ Reply to Thread
Results 1 to 5 of 5

Need a formula to find and substitute a word in a text if a condition is met...

  1. #1
    Registered User
    Join Date
    08-06-2014
    Location
    Tucson, Arizona
    MS-Off Ver
    XP
    Posts
    43

    Need a formula to find and substitute a word in a text if a condition is met...

    In cell A1, I have three possible text strings: (1) "change/s: changed the color green to red", (2) "change/s: changed the color from green to red, changed the size from big to small", or (3) "changed the color from red to green".

    I need a formula that will look at a text string, and if there is a comma in the string, it finds the word "change/s" and substitutes it with "changes", if it finds no comma, it substitutes the word "change/s" to "change", and if the word "change/s" is not in the text string at all, it leaves that text string unchanged.

    Any help would be much appreciated!
    Last edited by danielneedssomehelp; 08-18-2014 at 01:00 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Need a formula to find and substitute a word in a text if a condition is met...

    Something like this?

    =iferror(if(find(",",A1)>=1,substitute(A1,"change/s","changes"),),substitute(A1,"change/s","change"))
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  3. #3
    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
    43,984

    Re: Need a formula to find and substitute a word in a text if a condition is met...

    Try this out:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    08-06-2014
    Location
    Tucson, Arizona
    MS-Off Ver
    XP
    Posts
    43

    Re: Need a formula to find and substitute a word in a text if a condition is met...

    Yep, you nailed it Glenn! Works like a logical charm! Thank you!!!

  5. #5
    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
    43,984

    Re: Need a formula to find and substitute a word in a text if a condition is met...

    You're welcome and thanks!

+ 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] Find word in text string and return word adjacent to the left
    By eadamquinn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-06-2014, 03:22 PM
  2. condition formula after 1 week word become red
    By choy96 in forum Excel General
    Replies: 5
    Last Post: 01-17-2012, 10:43 PM
  3. How to use a substitute formula to substitute text entries to a different text entry
    By andybocchi in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-01-2010, 07:50 PM
  4. Replies: 4
    Last Post: 10-01-2010, 06:14 AM
  5. Replies: 5
    Last Post: 11-16-2009, 08:24 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