Reputation: 125
I am looking for a formula that counts only unique values based on the conditions.
Scenario: As shown in the image, I have three different enrollment statuses "Enrolled", "Completed", and "In Progress". What I am trying to achieve:
Check if value of Column A
values match/contain with Column F
.
If it does, then look at Column G
.
If a user has the status "Completed" or "Inprogress", then count those users as 1.
If the user status is "Enrolled", then do not count those users.
In B2
I should get the count 2, as "[email protected]" and "[email protected]" have the status "Completed" or "In Progress", whereas "[email protected]" doesn't have.
Can anyone please help me with this?
Upvotes: 1
Views: 153
Reputation: 101
PivotTables are ideal for situations like this.
Select your data set and click the "PivotTable" button on the "Insert" tab on the ribbon.
In the PivotTable Fields pane:
This will return a table with exactly what you're looking for.
Upvotes: 0
Reputation: 19712
You're interested in counting the emails - so first is to filter the list to the relevant emails.
Replace the literals with your cell references - Category A to A2 for example.
=FILTER(D2:D15,(F2:F15="Category A")*($G$2:$G$15<>"Enrolled"))
Now to get the uniques:
=UNIQUE(FILTER(D2:D15,(F2:F15="Category A")*($G$2:$G$15<>"Enrolled")))
and finally count the values:
=COUNTA(UNIQUE(FILTER(D2:D15,(F2:F15="Category A")*($G$2:$G$15<>"Enrolled"))))
Upvotes: 5
Reputation: 627
You can try with the COUNTIF
or COUNTIFS
functions (depending how many criteria you may give). Formula in Cell B2
could be:
=COUNTIFS($F$2:$F$10;$A$2;$G$2:$G$10;"In Progress")+COUNTIFS($F$2:$F$10;$A$2;$G$2:$G$10;"Completed")
It neglects the "Enrolled" since you do not want to count them.
Upvotes: 0