COUNTDIFF & IF Criteria

Reef

New Member
Joined
Jul 12, 2003
Messages
41
Hey Board,

I've been playing with the COUNTDIFF function (Morefunc) and find it great.

Now trying to nest an IF statement into the formula but having some trouble.

Hope someone could spare me some time to help with this? :)

Reef.

Data:
Column B contains Product Codes
Column C contains Y or N ... referring to yes or no.... whether the product has been selected
Column E refers to whether Copper is in the formula...it's on a few rows & blanks in the others

Formula: {=COUNTDIFF($E$2:$E$28,FALSE)}
Result: =1 .....shows that Copper is in the column.... Good.

Problem:
I need to countdiff only the rows in E2 to E28 that have a "Y" in C2 to C28.

I've tried {=COUNTDIFF(IF(C2:C28="Y",E2:E28),FALSE)} but it results in "2" if the two entries for copper have a "Y" next to them.

The aim is for the output to be....
"1" if any product with Copper in it is selected (with a "Y" in column B)
& "0" if I change the "Y"s to "N"s in column B.

Man... any ideas guys?? :)
 
Hey Dave,

I'm with you mate. :)

I'd thought the first of the two FALSE statements in your COUNTDIFF formula would stop the "0" from being counted. =COUNTDIFF(IF(C2:C28="Y",E2:E28),FALSE,FALSE)

b) Copper and blanks evaluates to Copper and 0 =2....
............"2" is what I'm getting but had expected "1". :(

Dave, can you see an adjustment that would force the "blanks" to be ignored?

Great stuff... looks so close to what is needed.

I guess =(COUNTDIFF(IF(C2:C28="Y",E2:E28),FALSE,FALSE)-1) is an option but it doesn't really harness COUNTDIFF very cleanly. :)

Reef
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,215,338
Messages
6,124,360
Members
449,155
Latest member
ravioli44

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