excel 2010 - Categorize cells by keywords -


i not if excel can trying simplify data dump twitter.

basically this:

if tweet (in column a) contains apple or orange or pear can classified (in column b) "fruit" if has carrot or squash or lettuce classified "vegetable". if has none of these can classified "none"

is possible?

thanks in advance.

here using array constant , range.

=if(sumproduct(if(iserror(search({"apple","orange","pear"},a1)),0,1))>0,"fruit",if(sumproduct(if(iserror(search({"carrot","squash","lettuce"},a1)),0,1))>0,"vegetable","none"))

now example, both fruit , vegetable present in string, test fruit first since way formula arranged. (e.g. "more apple on salad lettuce" return "fruit").
can use range contains list instead of array constant.
example, can put fruit list in column c (c1:c3) , vegetable list in column d (d1:d3).
formula be:

=if(sumproduct(if(iserror(search(c$1:c$3,a1)),0,1))>0,"fruit",if(sumproduct(if(iserror(search(d$1:d$3,a1)),0,1))>0,"vegetable","none"))

but need enter array formula using ctrl+shift+enter.
same results , rule apply when both fruit , vegetable appear on string. hth.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -