View Single Post
  #7   Report Post  
B. R.Ramachandran
 
Posts: n/a
Default

Hi,
You could try this approach(it assumes that the name you are looking for,
e.g., Bob, occurs either alone or in two-name combinations separated by a
slash, e.g., Bob/Joe or Joe/John, AND NOT in any othr format).
Let's imagine that the first name is in A2.
Use a helper column (say B) Make sure B1 is empty (or 0)

Enter the following formula in B2 and extend it to the rest of the rows.

=B1+IF(ISNUMBER(FIND("/",A2)),IF(LEFT(A2,FIND("/",A2)-1)="Bob",1,IF(RIGHT(A2,LEN(A2)-FIND("/",A2))="Bob",1,0)),IF(A2="Bob",1,0))

The formula would succesively add the occurrence of "Bob" in any of the
three possible formats; thus, the number at the bottom of column B is what
you want.
(Note: It will exclude variations of 'Bob" and also names where "Bob" is
embedded, but is not case-sensitive - i.e., would count "Bob" and 'bob"....)

Hope it works!
Regards,
B.R. Ramachandran

"James" wrote:

To make it easy, I am trying to count the number of times the name "Bob"
appears in a range of cells. Most of the time, "Bob" is the only name in the
cell, so COUNTIF would work. However, sometimes there will be 2 names in the
same cell, like this: "Joe/Bob." What kind of formula can I use to count the
number of times "Bob" appears in a range of cells, including the times there
are 2 names in the same cell? With the COUNTIF function, it is only counting
the number of times "Bob" appears alone in a cell within the range of cells.