相等列值的总和的公式 [英] Formula for summation on amount of equal column values

查看:79
本文介绍了相等列值的总和的公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出一个包含两列的电子表格,例如A和B,每列下面都包含n个值,所有文本;是否有一个公式可以让我仅填充一个包含A列和B列中相等值的单元格?

Given a spreadsheet with two columns, say A and B, each containing n values under it, all text; is there a formula that allows me to fill just one cell containing the amount of equal values in columns A and B?

示例:

    A   B
    -----
1   M   M
2   L   M
3   L   L
4   M   M
5   M   L
    -----
        3

由于A列和B列都在第1行和第4行中包含M,在第3行中均包含L,因此结果为(即2 + 1).

Since columns A and B both contain an M in rows 1 and 4, and an L in row 3, the result is (i.e. 2+1).

推荐答案

一个简单的解决方案是在Google电子表格中使用 QUERY 功能:

A simple solution is to use QUERY function in google spreadsheet:

=SUM(QUERY(A1:B5, "Select 1 where A = B"))

或使用 SUMPRODUCT :

Or using SUMPRODUCT:

=ARRAYFORMULA(SUM(((A:A)=(B:B)) * (1) ))

这篇关于相等列值的总和的公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆