如何计算Google表格中的数据匹配集条件

谷歌表格的COUNTIF和COUNTIFS函数是强大的数据分析工具。COUNTIF允许您根据单一条件计数,例如计算某个范围内数值小于或等于40的次数。若需匹配多个条件,COUNTIFS则派上用场,它可以同时考虑两个或更多范围的条件,如查找名字为'George'且年份大于1990的记录。通过这些函数,您可以更深入地理解并分析电子表格中的数据。
摘要由CSDN通过智能技术生成
Sheets Header

The COUNTIF function in Google Sheets lets you analyze data in your spreadsheet and returns the number of times it appears in your document if it meets a set of specific criteria. Here’s how to use it.

Google表格中的COUNTIF函数可让您分析电子表格中的数据,并在其符合一组特定条件时返回出现在文档中的次数。 这是使用方法。

使用COUNTIF匹配一种类型的条件 (Use COUNTIF to Match on One Type of Criteria)

Fire up Google Sheets and open a spreadsheet with data you want to count.

启动Google表格,然后打开包含您要计算的数据的电子表格。

Click on an empty cell and type =COUNTIF(<range>,<criterion>) into the cell or the formula entry field, replacing <range> and <criterion> with the range of data to count and the pattern to test, respectively. It should look something like this:

单击一个空单元格,然后在单元格或公式输入字段中输入=COUNTIF(<range>,<criterion>) ,分别用要计数的数据范围和要测试的模式替换<range><criterion> 。 它看起来应该像这样:

=COUNTIF(F2:I11,"<=40")
Click an empty cell, and then enter the COUNTIF function with the range and criterion you want to match.

After you press the “Enter” key, the cell will contain the number of times the range matches the exact criteria specified.

按“ Enter”键后,单元格将包含范围与指定的确切条件匹配的次数。

After you hit the Enter key, the amount of times the function matched will show in the cell.

If the range you want to count contains a string of text in it, it would look something like this:

如果您要计算的范围中包含文本字符串,则它将类似于以下内容:

=COUNTIF(C2:C11,"George")
You can match strings as well.

However, that function would return zero results as none of the cells in the range contain the exact string “George.”

但是,该函数将返回零结果,因为该范围内的所有单元格都不包含确切的字符串“ George”。

However, unless you use wildcards, the string needs to match exactly.

Instead, you need to use a wildcard to match all instances of directors with the first name George. You can use wildcards, such as “?” and “*” to match a single character and zero or more contiguous characters, respectively.

相反,您需要使用通配符来匹配名字为George的所有Director实例。 您可以使用通配符,例如“?” 和“ *”分别匹配单个字符和零个或多个连续字符。

To search for every director with the first name “George,” you should use the “*” wildcard in the function. It would look like this:

要搜索名字为“ George”的每个主管,应在函数中使用“ *”通配符。 它看起来像这样:

=COUNTIF(C2:C11,"George*")
Instead, use the * wildcard to match all instances of George as a first name.

If the string you’re trying to match contains an actual question mark or asterisk, you can prefix it with the tilde (~) as an escape character (ie ~? and ~*).

如果您要匹配的字符串包含实际的问号或星号,则可以在其前面加上波浪号(〜)作为转义符(即〜?和〜*)。

使用COUNTIFS匹配多个条件 (Use COUNTIFS to Match Multiple Criteria)

COUNTIF is excellent if you only need to match depending on one type of criteria; if you have more than one, you will use the COUNTIFS function. It works exactly the same as COUNTIF, except it accepts more than one range and/or criterion. Any additional ranges must have the same number of rows and columns as the first range.

如果您只需要根据一种类型的条件进行匹配,那么COUNTIF是非常好的选择。 如果您有多个,则将使用COUNTIFS函数。 它与COUNTIF完全相同,但是它接受多个范围和/或条件。 任何其他范围必须具有与第一个范围相同的行数和列数。

Simply add as many ranges and criteria you want to count into the function. The format is basically the same as COUNTIF. It should look something like this:

只需将要计算的尽可能多的范围和条件添加到函数中即可。 格式基本上与COUNTIF相同。 它看起来应该像这样:

=COUNTIFS(C3:C11,"George*",D3:D11,">=1990")
Have more than one range and criterion to match? Use the COUNTIFS function to count multiple ranges at the same time.


Whether you want to count a single set of criteria in a range or multiple ones, the use of both COUNTIF and COUNTIFS will help you analyze the data inside your spreadsheet.

无论您是要计算一个范围中的一组标准还是多个标准,同时使用COUNTIF和COUNTIFS都会帮助您分析电子表格中的数据。

翻译自: https://www.howtogeek.com/446398/how-to-count-data-matching-set-criteria-in-google-sheets/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值