我正在尝试使用LEFT公式来查找文本是否包含字母L到Z。
我知道找到L我会用:
=IF(LEFT(B2,1)="L", "Yes", "No")
如何在不输入每个字母的情况下包含字母L-Z?
答案 0 :(得分:1)
试试这个
=IF(SUM(IF(LEFT(B2,1)={"L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"},1,0)),"Yes","No")
稍短版本(使用Search
代替Find
使其不区分大小写)
=IFERROR(T(FIND(LEFT(B2,1),"LMNOPQRSTUVWXYZ"))&"Yes","No")
如果您真的想使用L-Z
这样的模式,那么您可以编写VBA用户定义函数(UDF)
Function IsLike(str As Variant, Patt As String) As Boolean
IsLike = str Like Patt
End Function
并像这样使用
=IF(IsLike(LEFT(B2,1),"[L-Z]"),"Yes","No")
或不区分大小写
= IF(IsLike(LEFT(B3,1)" [1- ZL-Z]"),"是""否&#34)
答案 1 :(得分:1)
尝试,
=IF(OR(LEFT(B2)={"L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}), "yes", "no")
......或,
=if(and(code(b2)>=76, code(b2)<=90), "yes", "no")
后一个公式区分大小写,但您可以在两个位置将CODE(B2)更改为CODE(UPPER(B2)),以使其不区分大小写。
如果您不想处理ASCII字符代码并且可以通过不区分大小写的比较来满足,则Excel的快速排序算法似乎就足够了。
=if(and(left(b2)>="L", left(b2)<="Z"), "yes", "no")
答案 2 :(得分:0)
答案 3 :(得分:0)
解决方案:
=IF(B2>="L*", "Yes", "No")
答案 4 :(得分:0)
这将寻找小写和大写......
=IF(AND(LEFT(B1,1)>=CHAR(76),LEFT(B1,1)<=CHAR(90)),"Yes","No")
这些字符代码用于大写字母,但excel也将小写字母返回为true。
如果由于某种原因你的excel不会将小写字母恢复为真,那么就使用这个
=IF(OR(AND(LEFT(B2,1)>=CHAR(76),LEFT(B2,1)<=CHAR(90)),AND(LEFT(B2,1)>=CHAR(108),LEFT(B2,1)<=CHAR(122))),"Yes","No")