Searching Cells in Excel

G

Guest

I need to set up a search function in Excel so that it can idetify a given
word in a sentence, which is written in one cell. For example,

If Cell A1 is the place where the word you are looking for is written.

Then in Cell B1 the following sentence is written: "I like playing
football".

If the user puts in "football" in cell A1, I need it to return a true for B1
because it regonises "football" in the sentence.
 
G

Guest

Duncan:

example:

Dim f As Variant
Dim checktxt As Boolean
Range("A1").Select
f = Split(Range("B1"), " ")
For i = 0 To UBound(f)
If f(i) = Range("A1") Then
checktxt = True
Exit For
Else
checktxt = False
End If
Next i
MsgBox checktxt
 
A

antoka05

if you need to know if the word present in cell A1 is in the cell B1
text you can put this formula in cell C1:
=FIND(A1,B1,1)
 
G

Guest

Thank you very much for your swift reponce. This sounds like the right
formula, but its just returning a number 16. I need it to say True if it
appears in the sentence, or a " 1" will do
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top