This is a hard one for me to explain, so I have attached a sample document to better demonstrate this.
I have found out how to search the number of times appears in a column.
{=SUM(IF(ISNUMBER(SEARCH(A15,A1:A6)),1,0))}
What I would like to do is to search the number of times two corresponding values appear within the same row.
In the attached example, I have two columns
COLUMN A(NAME)_________________B1(LETTERS)
Bob________________________________abc
Mary_______________________________abc
Fred_______________________________abc
Bob________________________________def
Mary_______________________________def
Fred_______________________________def
I would like to know the number of times BOB and abc appear in the same row.
In reality, the data appears more like this;
xxxBOBzzz
yyyBOBaaa
so it really needs to be a search string, rather than having the cells being "equal to" the value 'BOB'
I have only read access to the database I am extracting data from, so cannot re-jig the database, but I need to do calculations on the data.
Just to clarify what I'm asking... how do I count the number of times 'BOB' and 'abc' appear in the same row?
Any help would be greatly appreciated.
First, just to clarify...
can be done using COUNTIF with Wildcard (ie avoid Array)Code:{=SUM(IF(ISNUMBER(SEARCH(A15,A1:A6)),1,0))}
Second, to answer your question, based on your sample file and setupCode:=COUNTIF(A1:A6,"*"&A15&"*")
Though not requiring CTRL + SHIFT + ENTER the above function (SUMPRODUCT) is processed by XL along similar lines and has similar effect in terms of efficiency.Code:B8: =SUMPRODUCT(--ISNUMBER(SEARCH(LEFT($A8,FIND("-",$A8&"-")-1),$A$1:$A$6)),--ISNUMBER(SEARCH(REPLACE($A8,1,FIND("-",$A8&"-"),""),$B$1:$B$6))) copied down to B13
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks