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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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,214,620
Messages
6,120,559
Members
448,970
Latest member
kennimack

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