且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

结合修剪和if公式

更新时间:2023-11-18 09:23:58

在H2中,根据提供的图像,

In H2 per the supplied image,

=IF(NOT(SUM(COUNTIF(J2, "*"&{"bing","Adwords"}&"*"))), TRIM(LEFT(SUBSTITUTE(MID(M2,FIND("|",SUBSTITUTE(M2,"-","|",2))+1,LEN(M2)),"-",REPT(" ",LEN(M2))),LEN(M2))), "")

要添加一个条件,其中M2必须至少包含三个连字符,请使用 AND 并从原始字符的长度(减号)中减去用"(减号)替换连字符的长度.如果结果(差)为3或更大,则至少有三个连字符.

To add a condition where M2 must contain at least three hyphens, use AND and subtract the length of substituting the hyphens with "" (subtrahend) from the length of the original (minuend). If the result (difference) is 3 or more then there are at least three hyphens.

=IF(and((len(m2)-len(substitute(m2, "-", "")))>=3,NOT(SUM(COUNTIF(J2, "*"&{"bing","Adwords"}&"*")))), TRIM(LEFT(SUBSTITUTE(MID(M2,FIND("|",SUBSTITUTE(M2,"-","|",2))+1,LEN(M2)),"-",REPT(" ",LEN(M2))),LEN(M2))), "")