Home » excel » How to treat two same value as 1 and add with other value in excel

How to treat two same value as 1 and add with other value in excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have datasets which contains same value, please find the below datasets,
`

   A        B
1122513454  0
1122513460  0
1600041729  0
2100002632  147905
2840007103  0
2840064133  138142
3190300079  138040
3190301011  138120
3680024411  0
4000000263  4000000263
4100002263  4100002268
4880004352  138159
4880015611  138159
4900007044  0
7084781116  142967
7124925306  0
7225002523  7225001325
23012600000 0
80880593057 0
98880000045 0

`
I have two columns ( A & B).Into the b column i have same value (138159,138159).It appears two times.

I just want to build a formula, where it will get a same value it will count as 1. That means, i am getting two 138159, but formula will treat as 1. and finally it will count the whole b column value.
That means,
0 is here 10 times and other value is also 10 times, but 138519 appears 2 times, so it will counted as 1, so other values are 9 times.

So my expected output will be 10+9=19

I have written following formula for that

=+COUNTIF(K20:K39,0)+9

I did manually. and it’s driving me crazy.

can you guys help me for that.

any suggestion is really appreciable.

How to&Answers:

Try,

=SUMPRODUCT((B1:B20<>0)/COUNTIFS(B1:B20, B1:B20))