I
I
IVBAN2021-06-09 12:51:45
excel
IVBAN, 2021-06-09 12:51:45

Is there a function in excel to find a substring in a string?

There are two columns, you need to somehow select a row if the cells from one column contain a substring from a cell of another column within one row. if you can do without vba

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
anoriyuriy, 2021-06-09
@IVBAN

It is desirable to attach a minimally reproducible example.
That is: As it is now - As it should be
According to the description, the problem is solved simply. And the formula and conditional formatting, if you really need to highlight it.
Solution by formula
If there is a string in column A, and a substring in column B, then in C you can apply this formula:

=ЕСЛИ(ЕЧИСЛО(ПОИСК(B2;A2));"содержится";"не содержится")

60c112a72505c908594466.png
This formula does not contain an empty cell control in column B. It can be added to eliminate false positives:
=ЕСЛИ(B2<>"";ЕСЛИ(ЕЧИСЛО(ПОИСК(B2;A2));"содержится";"не содержится");"цвет не указан!")

60c1138f21a88953767032.png
Conditional Formatting Solution
Choose "Conditional Formatting" - "Create a Rule" - "Use a formula to determine formatted cells". Enter the following formula:
=ЕСЛИ(ЕЧИСЛО(ПОИСК($B2;$A2));ИСТИНА;ЛОЖЬ)
In "Applies to" specify the desired range: =$A$2:$A$5
The result will look like this:
60c117bf20a72392353201.png

J
John Smith, 2021-06-09
@ClearAirTurbulence

FIND \ SEARCH

The Excel FIND function returns the position (as a number) of one text string inside another. When the text is not found, FIND returns a #VALUE error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question