简体   繁体   English

Excel公式可将一个单元格与选定范围内的其他单元格进行比较

[英]Excel formula to compare a cell with other cells in a selected range

my name is Diego and i'm in need of your knowledge: 我叫迭戈,我需要你的知识:

I have a selected range of cells in a column and i need to compare one cell value (text) with the other cells in the selected range. 我在一列中有一个选定的单元格范围,我需要将一个单元格值(文本)与选定范围中的其他单元格进行比较。 the idea is to get the % of difference that rows have to the rest of values among columns, for example: 这个想法是获得行与列之间其余值的差异百分比,例如:

  A   B   C
 Yes Yes  0%
 Yes Yes  0%
 Yes Yes  0%
 Yes Yes  0%
 N/A Yes  50%
 Yes Yes  0%
 Yes Yes  0%
 Yes No   50%

i have a formula that is capable of doing the job for one column. 我有一个公式可以胜任一栏的工作。 the aim of this formula is to state if the selected cell is diferent than the others, so if it is, and its part of the minority (lets say lower than 50% of the selected choices), to add 1. if it is the same value as the majority, dont add a value (or add 0). 该公式的目的是说明所选单元格是否与其他单元格不同(如果是)以及它的少数部分(假设低于所选选项的50%),则加1。与多数相同的值,请勿添加值(或添加0)。 i know it seems tricky, so i'll explain with the formula: 我知道这似乎很棘手,所以我将用以下公式进行解释:

=IF(COUNTIF($A$1:$A$10;$A1)/COUNTA($A$1:$A$10)>0,5;0;1)

The formula is filled down, so the the formula keeps comparing among the range of formulas. 该公式已填写完毕,因此该公式会在各个公式范围之间进行比较。 But, as you can see on column C, the idea is to get an average of this individual comparisons. 但是,正如您在列C上所看到的那样,其想法是获得各个比较的平均值。 a formula: 公式:

=AVERAGE(COUNTIF($A$1:$A$10;$A1)/COUNTA($A$1:$A$10)>0,5;0;1);COUNTIF($B$1:$B$10;$B1)/COUNTA($B$1:$B$10)>0,5;0;1))

So i just take an average of the formula repeated for each column in the range of cells that are with data. 因此,我只是对包含数据的单元格范围内的每一列重复计算公式的平均值。

Here's where it get's real tricky... 这是真正棘手的地方...

the idea is to make the formula to tell if there's a TIE and in which column. 想法是使公式能够确定是否有TIE,以及在哪一列中。 so to say: 可以这么说:

 A   B   C
Yes Yes TIE IN COLUMN A
Yes Yes TIE IN COLUMN A
N/A Yes TIE IN COLUMN A
Yes Yes TIE IN COLUMN A
N/A Yes TIE IN COLUMN A
N/A Yes TIE IN COLUMN A
Yes Yes TIE IN COLUMN A
N/A No  TIE IN COLUMN A

Please advise me in this matter!! 请告诉我这件事! your help is very welcome. 非常欢迎您的帮助。 Thanks! 谢谢!

Well I think this will do what you want, keep in mind the ranges are probably not what you want 好吧,我认为这将满足您的要求,请记住,范围可能不是您想要的

=IFERROR((IF(A2=INDEX($A$2:$A$11,MODE(MATCH($A$2:$A$11,$A$2:$A$11,0)+{0,0})),1,0)+IF(B2=INDEX($B$2:$B$11,MODE(MATCH($B$2:$B$11,$B$2:$B$11,0)+{0,0})),1,0))/2,"")

I am not sure exactly what you are talking about in your 2nd part, but maybe this gets you all you need. 我不确定您在第二部分中到底在说什么,但是也许这可以满足您的所有需求。

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

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