Count duplicate cell values as one if multiple criteria are met

Isabella

I am trying to get the total count of entries per month based on the status ("Settled") and the distinct code. If the other status of the other entries in that certain code is not yet settled, it shouldn't count. Please see example below and the expected output.

MONTH   |CODE  |CONTRIBUTION|STATUS
JANUARY |CS-111|500         |Settled
JANUARY |CS-111|500         |Settled
FEBRUARY|CS-131|200         |Settled    
FEBRUARY|CS-131|200         |Waiting
FEBRUARY|CS-141|300         |Settled
MARCH   |CS-151|400         |Waiting
MARCH   |CS-161|700         |Settled

Sample output:

January  | 1  | 1 because same code and status
February | 1  | 1 because only CS-141 is settled, the second entry of CS-131 is Waiting
March    | 1  | 1 because only CS-161 is settled

This is my formula based on this question:

=SUMPRODUCT(--($A$2:$A$8="January"),--(COUNTIFS($A$2:$A$8,$A$2:$A$8,$B$2:$B$8,$B$2:$B$8,$D$2:$D$8,"Settled")=0))

With the formula above, I get 2 as the output for January and not 1. 1 because they have the same code and status. Could you kindly help me which concept I should apply to get the expected output? Hope my question is clear. Thank you very much.

Apologies if this question has been asked before.

JvdV

Imagine this setup:

enter image description here

Formula in G2:

=SUM(--(FREQUENCY(IF(($A$2:$A$8=G2)*($D$2:$D$8="Settled"),IF(COUNTIFS($B$2:$B$8,$B$2:$B$8,$D$2:$D$8,"Waiting")=0,MATCH($B$2:$B$8,$B$2:$B$8,0))),ROW($B$2:$B$8)-ROW($B$2)+1)>0))

Note: It's an array formula and needs to be confirmed through Ctrl+Shift+Enter

Drag down...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

List all values if one condition per criteria is met

List all values if value exists multiple times and if one condition per criteria is met

Multiple values in one cell

List cell values if criteria met in Google Sheet

Filter on multiple criteria defined in one cell

Return multiple match index lookups into one cell with multiple criteria

Count the number of dates that a criteria is met

How to copy values based on multiple cell criteria to another Sheet

Count unique values in excel based on multiple criteria

How to Count Duplicate values based on other cell values in google sheet

Excel - Count unique values that meets multiple criteria

Query using multiple criteria on one field where ALL criteria has to be met

How to count multiple values in one single cell using Pivot Tables in Excel?

Large index match with multiple criteria, duplicate values

Multiple nested Iif and count statements in one cell

VLOOKUP with multiple criteria returning values in one cell

How do I count cell values in one column using a criteria of another column in Excel?

Using Countifs to count distinct values and multiple criteria?

Count MAX consecutive values with multiple criteria

Update cell values based on dependent drop down lists/multiple criteria

Python, Pandas - count values based on multiple criteria in row and multiple columns

SQL Count when criteria is met

Combine multiple row pandas if met NaN Values and lowercase in 2 cell

Count distinct values based on multiple criteria

EXCEL Count unique values if criteria met

Filter column for multiple values but only select the last one for one criteria

Replace multiple values in one cell

How to lookup multiple values based on multiple criteria in one cell?

Copy single cell value in range if multiple criteria is met