Forum Discussion

christianvost's avatar
christianvost
Copper Contributor
Feb 16, 2018

Excel formula to find a string in column cells and output a value in column cells to the right.

Hi There,

I am trying to create a formula to find a string(s) in a column of data. The column in approx 3000 rows with different words in each cell. Some contain the strings, some do not.  If a string is found, I need  to output a value in the cell in the column to the right of it. It is not case sensitive eg. search "Dog" or "dog".

 

Logic example:

 

If the word "dog" is found in the cell, then output the word "dog" in the cell in the next column.

 

else if, the word "groom" is found in the cell, then output the word "grooming" in the cell in the next column.

 

else if, the word "vet" is found in the cell, then output the word "vet" in the cell in the next column.

 

else if, the word "food" is found in the cell, then output the word "pet food" in the cell in the next column.

 

else if, the word "fish" or "aqua" is found in the cell, then output the words "fish and aquatics" in the cell in the next column.

 

else, return "pet shops" to all those remaining cells in the next column. 

 

Note:
Some of the words that I am looking for in the column, are (example) "easydoglife" and I would need the formula to recognise "dog" and output it to the cell in the column to the right.

I am using an old version of excel, for windows XP I think? but I don't think this matters

Could anyone help turn my pseudo-mess into a nice formula ?

 

Thanks in advance, I'm losing hair...

Chris.

 

 

 

  • Hi,

     

    I have a solution for you, but it's supported by a complicated array formula!

    Please find the attached file!

     

    The problem is: you have an earlier version of Excel and earlier versions before Excel 2007 have many limitations and legacy functions, so I didn't find a solution easier than this!

    • christianvost's avatar
      christianvost
      Copper Contributor

      Ah, that's a really neat solution, thanks Haytham Amairah!

       

      Would it be possible to modify this slightly though?

       

      Example:

       

      I have cells in a column containing words like "petgroomers" and need the formula to find the string "groom" in that cell, and then return the "groomers" value to the cell on the right. (instead of looking for the exact words in the cell. I've been looking at the excel 'search' function, but not sure how to implement it, or even if it would be correct in this case?

       

      Also, if the words "dog" AND "food" (two of the search terms) are found in the same cell, to return "dog" as default?

       

      I have attached a file showing column A data, and the outputs that I need in column B. 

       

      Is this possible? 

       

      Many thanks for your expertise. I really appreciate it!

      Chris.

       

      • Haytham Amairah's avatar
        Haytham Amairah
        Silver Contributor

        Hi,

         

        I have a solution for you, but it's supported by a complicated array formula!

        Please find the attached file!

         

        The problem is: you have an earlier version of Excel and earlier versions before Excel 2007 have many limitations and legacy functions, so I didn't find a solution easier than this!

Resources