My example is that on column A, I have different names.
Let these be, in order of appearance, starting with A1
:
{Joe, Michael, Ana, Victor, Joe, Ana, George, Victor, Chris, George, Joe, Michael, Ana, Victor, Joe, Michael}
So Joe is in A1
, Michael is in A2
, Ana in A3
etc.
On column B I have the values of subset which I want to search for in the set of values of names from column A. Let this subset, starting with B1, be:
{Joe, Michael}
So Joe is in B1
and Michael is in B2
.
I am looking for a single formula that:
- Which will not use calculations from other cells
- Which will count how many times will the values of the subset be included, in the order provided (e.g. Joe, Michael), in column A.
For the this example it should return value 3.
This being said , I actually need a more general formula which will work for any subset, independently of the number of elements of it.
Please note that there is no information about the maximum size of the subset.
Can anyone suggest a formula?
Here is an array formula that may be of assistance to you. It is using Column A offsetted :
=SUM(IF(EXACT(A1:A499&A2:A500,B$1&B$2),1,0))
and then CTRL+SHIFT+ENTER