简体   繁体   English

如何计算包含“字符串”的单元格

[英]How to count cells that cointain a “string”

I have a spreadsheet containing 2800+ rows of server names. 我有一个包含2800多个服务器名称行的电子表格。 When we decommission a server the server name is appended with ".decom". 当我们停用服务器时,服务器名称后会附加“ .decom”。 I need a count of how many in the column contain the ".decom". 我需要计算列中包含“ .decom”的数量。 In sql I would have used a simple "like '%decom%', but I am not sure how to do this in excel or if it is even possible. 在sql中,我会使用一个简单的“ like'%decom%',但是我不确定如何在excel中执行此操作,甚至不确定。

Use COUNTIF() with a wildcard string. COUNTIF()与通配符字符串一起使用。 Just do this: 只要这样做:

=COUNTIF(A1:A100,"*.decom")

(Assumes your range is A1:A100 , so modify as needed.) (假设您的范围是A1:A100 ,请根据需要进行修改。)

Can you use v-lookup and specify a wild card? 您可以使用v查找并指定通配符吗?

=VLOOKUP("*"&C1&"*",author_names!A1:B100,1,FALSE)

If you need to check if a string is contained in another string you can use SEARCH or FIND . 如果需要检查另一个字符串中是否包含一个字符串,则可以使用SEARCHFIND

JonH -- wild cards are not permitted in vlookup() , however they can be used with index(match()) JonH-vlookup vlookup()不允许使用通配符,但是可以将它们与index(match())

eg: index( author_names!a1:a100,match("*"&c1&"*",author_names!a1:a100,0)) 例如: index( author_names!a1:a100,match("*"&c1&"*",author_names!a1:a100,0))

note the return value is the value of the first matching wild card found. 请注意,返回值是找到的第一个匹配通配符的值。

BTW: your vlookup() example specifies 2 columns (A &B) but you're returning only the first column value (1), so my example does the same... if you really meant to return the value of the second column in the vlookup() , change my example to 'author_names!b1:b100', immediately following 'index('. 顺便说一句:您的vlookup()示例指定2列(A&B),但是您仅返回第一列值(1),所以我的示例也执行相同的操作...如果您确实要返回第二列的值, 'author_names!b1:b100', immediately following 'index('. vlookup() ,将我的示例更改为'author_names!b1:b100', immediately following 'index('.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM