Excel如何比较2列范围 [英] Excel How to compare 2 Column Ranges

查看:147
本文介绍了Excel如何比较2列范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试比较Excel中的两组列范围。

I am trying to compare two set of column ranges in Excel.

我知道标准比较公式:

例如。 =(A1 = E1)

我要寻找的是以下公式
的替代品 = AND(A1 = E1,B1 = F1,C1 = G1)

What I am looking for is a replacement for the following formula =AND(A1=E1,B1=F1,C1=G1)

因为列数很大我在想是否可以使用单元格范围。

since the number of columns is large I was thinking if it is possible to use a cell range.

推荐答案

= SUMPRODUCT(PRODUCT(- -(A1:D1 = E1:H1)))

SUMPRODUCT 是强制将其评估为数组公式

The SUMPRODUCT is to force it to evaluate as an Array Formula

PRODUCT 将所有值相乘

- TRUE 转换为 1 FALSE 转换为 0

A1:D1 = E1:H1 ,以数组公式表示,给出了数组 {A1 = E1,B1 = F1,C1 = G1,D1 = H1}

A1:D1=E1:H1, evalauated as an Array Formula, gives the array {A1=E1,B1=F1,C1=G1,D1=H1}

因此,将数组计算为 TRUE 的列表,然后 FALSE -将此转换为 1 s和 0 s,然后 PRODUCT 将列表中的所有值相乘。 ( 1 0 的乘积与 AND 相同 TRUE FALSE )-如果您使用评估公式,则可以逐步观察并观察它的发生

So, the array is calcuated as a list of TRUE and FALSE. The -- converts this into a list of 1s and 0s, and the PRODUCT multiplies all the values in the list together. (Multiplication of 1 and 0 is the same as AND with TRUE and FALSE) - if you use "Evaluate Formula", you can step through and watch it happen

{EDIT} 正如汤姆·夏普(Tom Sharpe)在他的回答中指出的那样,我对此有些复杂了-您可以使用 AND 而不是 PRODUCT ,例如:
= SUMPRODUCT(-AND( A1:D1 = E1:H1))

这篇关于Excel如何比较2列范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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