Forum Discussion
Check if a cell contains a word in listA, if not, then check if it contains a word in listB etc..
- Feb 29, 2024
=TOROW(IFERROR(FILTER(Keywords!$D$213:$D$300,
DROP(N(
REDUCE("",SEQUENCE(88),
LAMBDA(u,v,VSTACK(u,IF(C2="Incident",
AND(
OR(COUNTIF(E2, "*" & TEXTSPLIT(INDEX(Keywords!$G$213:$G$300,v),,"،") & "*"),COUNTIF(G2, "*" & TEXTSPLIT(INDEX(Keywords!$G$213:$G$300,v),,"،") & "*")),
OR(COUNTIF(E2, "*" & TEXTSPLIT(INDEX(Keywords!$H$213:$H$300,v),, "،") & "*"),COUNTIF(G2, "*" & TEXTSPLIT(INDEX(Keywords!$H$213:$H$300,v),, "،") & "*"))))))))
,1)),
"not incident"))
This should work if i correctly understand what you want to do. The formula is in cell H2 in the attached sample file and filled down. If there are two or more matches for the search criteria in columns E and G of Sheet1 the formula spills the results to the right.
=TOROW(IFERROR(FILTER(Keywords!$D$213:$D$300,
DROP(N(
REDUCE("",SEQUENCE(88),
LAMBDA(u,v,VSTACK(u,IF(C2="Incident",
AND(
OR(COUNTIF(E2, "*" & TEXTSPLIT(INDEX(Keywords!$G$213:$G$300,v),,"،") & "*"),COUNTIF(G2, "*" & TEXTSPLIT(INDEX(Keywords!$G$213:$G$300,v),,"،") & "*")),
OR(COUNTIF(E2, "*" & TEXTSPLIT(INDEX(Keywords!$H$213:$H$300,v),, "،") & "*"),COUNTIF(G2, "*" & TEXTSPLIT(INDEX(Keywords!$H$213:$H$300,v),, "،") & "*"))))))))
,1)),
"not incident"))
This should work if i correctly understand what you want to do. The formula is in cell H2 in the attached sample file and filled down. If there are two or more matches for the search criteria in columns E and G of Sheet1 the formula spills the results to the right.
Thank you so much, I really appreciate it!!