Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I have a string to find in a cell such as:

[Agent Name & ID: Christopher Montaray - 1011]

… and I use the IF statement, can I search for a part of it? For example:

=IF (A1="Chris",1,0)
share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

You need to use SEARCH or FIND, which will return the position of the start of the string you want to locate, or an error if the string is not present. e.g.

=SEARCH("Chris", A1)

You can then use IFERROR or another function like that to handle the error case.

share|improve this answer
add comment

You could also use COUNTIF function with a wildcard which will give you 1 or 0 directly

=COUNTIF(A1,"*Chris*")

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.