Page 1 of 1

test check string contain

Posted: Sat May 29, 2021 10:47 pm
by sna
Hi dear !
I need any formula in E2:H6(expected result provided) to indicate if the number in E1:H1 is covered (included) in range description in column A (for the same row). display "yes" if included, "No" if not included

Example,"YES" in H2 means 311(H1) included in range description "310-312" in A2
Note highlight cells are expected results

Best Wishes,

Re: test check string contain

Posted: Sun May 30, 2021 1:23 pm
by snasui
:D The example formula in E2 is,

=IF(SUMPRODUCT(--(INT(FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE($A2,"-","."),",","</s><s>")&"</s></t>","//s"))<=E$1),--(--RIGHT(FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE($A2,"-",REPT(" ",10)),",","</s><s>")&"</s></t>","//s"),10)>=E$1)),"YES","NO")

Enter > Copy to the right side and down.

Re: test check string contain

Posted: Sun May 30, 2021 10:15 pm
by sna
Thank you so much

Re: test check string contain

Posted: Mon May 31, 2021 6:56 am
by logic
Another solution,

E2 =IF(SUMPRODUCT(--(E$1>=TEXT(MID(SUBSTITUTE(SUBSTITUTE($A2,"-","."),",",REPT(" ",50)),50*(ROW($1:$50)-1)+1,50),"0;;;\0")+0),--(E$1<=TEXT(RIGHT(SUBSTITUTE(TRIM(MID(SUBSTITUTE($A2,",",REPT(" ",50)),50*(ROW($1:$50)-1)+1,50)),"-",REPT(" ",20)),20),"0;;;\0")+0)),"YES","NO") 😊

Re: test check string contain

Posted: Mon May 31, 2021 10:13 am
by sna
Thank you both