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.
Imagine this setup:
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.
Comments