Reputation: 3512
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
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")
Upvotes: 3
Views: 7638
Reputation: 46371
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
Upvotes: 5
Reputation: 27478
Put this in D2 and drag down:
=IF(COUNTIFS(B$2:B2,B2,C$2:C2,"Yes")=1,1,"don't count")
Upvotes: 1