Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count number of "Yes" in column C once only if ID in column B repeats

I need help counting Yes in column C, but only count it once if ID in column B repeats

Sample of output. for sample below count should be 6.

Here is dropbox file link. Dropbox file link

enter image description here

I can do this already via if and else condition using formula, but I would like someone can come up with better way using single line formula.

Current solution in cell F2

=IF(B2<>B1,IF(C2="Yes","1",""),IF(B2=B1,IF(F1="1","",IF(B2=#REF!,"",""))))

in cell F3 and down

=IF(B3<>B2,IF(C3="Yes","1",""),IF(B3=B2,IF(F2="1","",IF(B3=B1,"",""))))

Then I just count all ones and get total 1.

=countif(F2:F159,"1")
like image 676
Mowgli Avatar asked Nov 30 '25 04:11

Mowgli


1 Answers

You can use a similar approach to my previous answer in your link, i.e. using cell refs in your dropbox example

=SUM(IF(FREQUENCY(IF(I2:I14="Yes",H2:H14),H2:H14),1))

confirmed with CTRL+SHIFT+ENTER

H2:H14 has to be numeric data

Generically, assuming Range 4 is numeric you can use this formula for up to 3 conditions

=SUM(IF(FREQUENCY(IF((Range1="x")*(Range2="y")*(Range3="z"),Range4),Range4),1))

conditions can be added or removed as required

like image 109
barry houdini Avatar answered Dec 03 '25 04:12

barry houdini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!