Google Sheets - Compare multiple words in cell with another cell & count number of matches

耗尽温柔 提交于 2019-12-13 05:09:47

问题


If cell A1 contains "Brother Sister Father Mother Grandson" and cell A2 contains "Mother Father", return 2 in cell A3.

How can I achieve this?


回答1:


Try

=SUMPRODUCT(TRANSPOSE(SPLIT(A1," "))=SPLIT(A2," "))



回答2:


For the giving example, this formula entered in A3 should work

=sum(ArrayFormula(--regexmatch(split(A1, " "), substitute(A2, " ", "|"))))

All depends on how the "real data" is structured.



来源:https://stackoverflow.com/questions/50772870/google-sheets-compare-multiple-words-in-cell-with-another-cell-count-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!