[英]Compare cell contents against string in Excel
Consider the following: 考虑以下:
A B
1 ENG 1
2 ENG 1
3 FRA 0
4 FOO 0
I need a formula to populate the B
column with 1
if the A
column contains the string ENG
, or 0
otherwise. 我需要一个公式来填充
B
与柱1
,如果A
列包含字符串ENG
,或0
否则。
I've tried (in cell B1) =IF(A1=(TEXT(ENG;FALSE));1;0)
but then it says #NAME?
我已经尝试过(在单元格B1中)
=IF(A1=(TEXT(ENG;FALSE));1;0)
然后它说#NAME?
in the cell. 在牢房里。 Putting
ENG
between quotation marks doesn't help either. 将
ENG
引号之间也无济于事。 What should my formula be like? 我的公式应该是什么样的?
您可以使用EXACT
函数进行精确的字符串比较。
=IF(EXACT(A1, "ENG"), 1, 0)
如果可以接受不区分大小写的比较,只需使用=
:
=IF(A1="ENG",1,0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.