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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -