简体   繁体   English

Excel公式比较两列

[英]Excel formula to compare two columns

I need a formula to compare two columns which will return true if all integer values in first column are not less then all integer values in second column. 我需要一个比较两列的公式,如果第一列中的所有整数值均不小于第二列中的所有整数值,则该公式将返回true。

Can anyone help me with this? 谁能帮我这个?

UPDATE: 更新:

I need to do some calculations if numbers in each row in column H greater then value in column I (picture below). 如果H列中的每一行中的数字大于I列中的值,则需要进行一些计算(下图)。 I need this formula to return TRUE or FALSE because I will use it in another more complex formula. 我需要此公式返回TRUE或FALSE,因为我将在另一个更复杂的公式中使用它。

example picture 示例图片

UPDATE: 更新:

I form this excel file from Java code and I need include this formula to the cell. 我从Java代码中形成了这个excel文件,我需要将此公式包括到单元格中。 It's not good to use any extra columns in this case. 在这种情况下,使用任何多余的列都是不好的。

i would do it in this way: 我会这样:

result of each line (here C2): =IF(A2>=B2;1;0) 每行的结果(此处为C2): =IF(A2>=B2;1;0)
and then the end result (here C5): =IF(COUNTIF(C2:C4;0)>0;TRUE;FALSE) 然后是最终结果(此处为C5): =IF(COUNTIF(C2:C4;0)>0;TRUE;FALSE)

The array formula 数组公式

{=AND(H6:H32>I6:I32)}

will give you TRUE if each value in column H is greater than the corresponding value in I (so H6 greater than I6 and H7 greater than I7 and ... and H32 greater than I32 ) and FALSE otherwise. 会给你TRUE如果列中的每个值H比相应的值在I (所以H6大于I6H7大于I7和......和H32大于I32 )和FALSE否则。

Array formulae are entered through Excel's GUI using CTL + SHIFT + ENTER keyboard combination to commit the formula or by setting a cell's FormulaArray property in VBA. 数组公式是通过Excel的GUI使用CTL + SHIFT + ENTER键盘组合输入的,以提交公式或通过在VBA中设置单元格的FormulaArray属性来输入。

Alternatively, this non-array formula 或者,此非数组公式

=SUMPRODUCT(1*(H6:H32>I6:I32))=27

will also deliver the same result but in a less elegant way. 也将以不那么优雅的方式提供相同的结果。

If for example you have column A and B, then try this in column C: 例如,如果您有A列和B列,请在C列中尝试以下操作:

=(B1<=A1)

It will return as True or False in column C 它将在C列中返回True或False

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

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