COUNTIF formula - help adding more to it

jamstr

New Member
Joined
Aug 23, 2017
Messages
1
Hi there

I have a spreadsheet (12000+ rows). Column A has lots of names but essentially only about 20 different ones.
Column B has values, many positive and negative numbers, that cancel themselves out.

I want to delete the rows that cancel themselves out BUT only if the text in Column A is the same. I can do the first part but cannot expand on the formula.
If I filter on A to only show one name the following formula works. If I expand it to be all rows then the answer is wrong.
=COUNTIF($B$2:$B$100,B2)<>COUNTIF($B$2:$B$100,-B2)

Example 1:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Apple[/TD]
[TD]
12.46​
[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]
3.45​
[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]
-3.45​
[/TD]
[TD]FALSE[/TD]
[/TR]
</tbody>[/TABLE]

Example 2:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Apple[/TD]
[TD]
12.46​
[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD="align: right"]3.45[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD="align: right"]-3.45[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]Pear[/TD]
[TD="align: right"]8.20[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]Pear[/TD]
[TD="align: right"]-12.46[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD="align: right"]15.22[/TD]
[TD]TRUE[/TD]
[/TR]
</tbody>[/TABLE]

Can I have a formula that works like example 1 but checks to see if the text in A is the same?
=COUNTIF($B$2:$B$100,B2)<>COUNTIF($B$2:$B$100,-B2) only if A = A

Thanks
Stef
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi, welcome to the forum!

Maybe you could use COUNTIFS() to also test that column A matches:

=COUNTIFS($A$2:$A$100,A2,$B$2:$B$100,B2)<>COUNTIFS($A$2:$A$100,A2,$B$2:$B$100,-B2)
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top