hi there...
we can check it, yes:
{=SUM(--NOT(ISERROR(FIND( KEYWORDLIST , A1))))}
imagine your list of keyords to search for is {aaa,bbb,ccc,ddd,eee}. you define this list as KEYWORDLIST range in excel.
in cell A1 there is something like "aaa ccc fff" therefore you want a formula that returns 2, as you can find 2 searchable keywords in cell A1 ("aaa" and "ccc").
the FIND() function tries to find a string of text within a cell, returning the position within the cell where the string is found... if the string is not found, it returns a N/A error.
when we run FIND( KEYORDLIST , A1), we are running FIND ( {aaa,bbb,ccc,ddd,eee} , "aaa ccc fff") and, BECAUSE WE ARE RUNNING IT IN VECTOR FORMAT (i can explain it later), he tries to find each element in KEYWORDLIST and returns a result for each element, so it would return somethig like:
FIND( KEYORDLIST , A1) =
FIND ( {aaa,bbb,ccc,ddd,eee} , "aaa ccc fff")=
{1,#N/A,5,#N/A,#N/A}
1 is the position where "aaa" is in "aaa ccc fff" and 5 the same for "ccc"... the #N/A are errors because "bbb" "ddd" and "eee" are not found in A1.
we have now {1,#N/A,5,#N/A,#N/A}
running ISERROR over this vector will return, of course
ISERROR( {1,#N/A,5,#N/A,#N/A} ) =
{FALSE,TRUE,FALSE,TRUE,TRUE}
running NOT over this will invert the TRUEs and FALSEs
NOT( {FALSE,TRUE,FALSE,TRUE,TRUE} ) =
{TRUE,FALSE,TRUE,FALSE,FALSE}
using the -- trick turns TRUEs into 1s and FALSEs into 0s, so putting the -- will give you:
--( {TRUE,FALSE,TRUE,FALSE,FALSE} ) =
{1,0,1,0,0}
note you now have a vector with 1s in places of keywords found and 0s in keywords not found... summing this vector will give you the number of keywords found.
SUM( {1,0,1,0,0} ) = 2 (ok this last one was kind of obvious! :D )
----------------
VERY IMPORTANT:
----------------
DO NOT FORGET TO RUN THIS FORMULA IN VECTORIAL FORMAT (this simply means you write the formula like a normal one, but you dont press only Return to validate it, you press Ctrl-Shift-Return).