Countif using a range comparison

smurphy1977

New Member
Joined
Nov 29, 2010
Messages
3
I am trying to come up with a Countif formual using a range comparison but I don't know if it is possible.

What I a trying to do is to count how many cells differences there are . For example if A1 does not equal B1 then count, if A2 does not equal B2 then count.

A B
1 1
1 2
2 1
2 2

If I had the correct formula in this example I should generate a count of 2.

I just can't get it to work. Can anyone help? Is it even possible?

I was thinking =COUNTIF(A1:A4, "<>B1:B4") but that doesn't work. Doing it that way it counts everthing and gives me a 4

-Sage
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try the following:
Excel Workbook
ABCD
1112
212
321
422
Sheet1
Excel 2003
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
 
Upvote 0
I am trying to come up with a Countif formual using a range comparison but I don't know if it is possible.

What I a trying to do is to count how many cells differences there are . For example if A1 does not equal B1 then count, if A2 does not equal B2 then count.

A B
1 1
1 2
2 1
2 2

If I had the correct formula in this example I should generate a count of 2.

I just can't get it to work. Can anyone help? Is it even possible?

I was thinking =COUNTIF(A1:A4, "<>B1:B4") but that doesn't work. Doing it that way it counts everthing and gives me a 4

-Sage

Try...

=SUMPRODUCT((A1:A4<>B1:B4)+0)
 
Upvote 0
Awesome! Would you be able to talk me through the logic because I am trying to wrap my head around it.

I've got = Count (if range 1 does not equal range 2, then ......)

and then I get lost.

And say I wanted to excude any 3's that were in column b in the count what would I add then.
Would it be:

=COUNT(IF(A1:A4<>B1:B4,A1:A4,""))-Count(if(B1:B4=3,1,0) ????

Try the following:

Excel Workbook
ABCD
1112
212
321
422
Sheet1
Excel 2003
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}. Note: Do not try and enter these manually yourself
 
Upvote 0
it converts the true's and false's returned by the A2:A6<>B2:B6 into 1's and 0's. 1 being true and 0 being false.
 
Upvote 0

Forum statistics

Threads
1,224,921
Messages
6,181,770
Members
453,065
Latest member
jfrsanders

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