Trouble retrieving the matched criteria using Search Function in Excel

…衆ロ難τιáo~ 提交于 2019-12-11 15:27:31

问题


I am using the code below successfully to test every cell in a table's column (task_short_text column) to see if they contain a specific word within each one of them. The range of words I am searching within each cell is stored in another sheet (Parameters!$A$2:$A$15). The way this formula has worked is by returning a TRUE or FALSE result, Ex: If the string in the cell contains "The Dog barks" and the word "dog" is in the search range, the output will be TRUE.

Instead of returning TRUE, I want my formula to return the word it found in the search range. So, for example, if the formula finds "dog" in the Parameters sheet, I would like for the return to be "dog" instead of TRUE.

I have tried using the SEARCH function without the SUMPRODUCT and ISNUMBER functions, but this yields an error (#VALUE!)

=SUMPRODUCT(--ISNUMBER(SEARCH(Parameters!$A$2:$A$15,[@[task_short_text]])))>0

回答1:


Here is a simple example to approach this issue:

Formula in cell B2:

=IFERROR(LOOKUP(1,1/COUNTIF(A2,"*"&$D$2:$D$4&"*"),$D$2:$D$4),"")

Drag down.



来源:https://stackoverflow.com/questions/56672807/trouble-retrieving-the-matched-criteria-using-search-function-in-excel

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