简体   繁体   中英

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). 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. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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