#Value or #DIV/0! Error

NewUser1070

New Member
Joined
Nov 8, 2010
Messages
3
I want to count the number students (Column B) that completed a task (Column C). But I only want to count the student one time. I also need to be able to account for blank/null cells because I am not sure how many entries will be in my sheet.

Here is a data:

Student 1 Yes
Student 2 Yes
Student 3 Yes
Student 4 No
Student 1 No
Student 2 Yes
Student 3 Yes
Student 4 No

So my result I am looking for is 3.

Here is the formula I tried and received the #DIV/0! error:

=SUMPRODUCT(--(C2:C10="Yes"),1/COUNT(IF(B2:B10="",0,B2:B10),IF(B2:B10="",0,B2:B10),IF(C2:C10="",0,C2:C10),IF(C2:C10="",0,C2:C10)))

Here is the formula I tried and recieved a #VALUE error:
=SUMPRODUCT(--(C2:C10="Yes"),1/COUNTIFS(IF(B2:B10="",0,B2:B10),IF(B2:B10="",0,B2:B10),IF(C2:C10="",0,C2:C10),IF(C2:C10="",0,C2:C10)))

This works correctly, but only includes cells with data:
=SUMPRODUCT(--(C2:C9="Yes"),1/COUNTIFS(B2:B9,B2:B9,C2:C9,C2:C9))
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Try this array formula

=SUM(--(FREQUENCY(IF(C2:C10="Yes",MATCH(B2:B10,B2:B10,0)),ROW(INDIRECT("1:"&ROWS(B2:B10))))>0))
 
Upvote 0
Control+shift+enter, not just enter:
Code:
=SUM(IF(FREQUENCY(IF(B2:B10<>"",IF(C2:C10="Yes",
   MATCH("~"&B2:B10,B2:B10&"",0))),ROW(B2:B10)-ROW(B2)+1),1))
which won't be affected by empty or blank cells.

If you have the relevant ranges defined as STUDENTS and TAGS...
Code:
=SUM(IF(FREQUENCY(IF(STUDENTS<>"",IF(TAGS="Yes",
   MATCH("~"&STUDENTS,STUDENTS&"",0))),
    ROW(STUDENTS)-MIN(ROW(STUDENTS))+1),1))

Note. Remove the "~"& and &"" bits from the formula for the student names presumably will not contain chars like < or *, etc.
 
Upvote 0

Forum statistics

Threads
1,214,634
Messages
6,120,659
Members
448,975
Latest member
sweeberry

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