@Peter_SSs can you explain your last formula please, i can follow it except I don't see how it picks up the number of ABC2*P.
I'll try with this example with just 3 terms and the formula reduced to allow for up to 4 terms.
20 07 23.xlsm 



 A  B 

1  Results  Count 

2  ABC2020:D:72, ABC2040:P:52, ABC2050:P:52,  2 



, & A2 = ", ABC2020:D:72, ABC2040:P:52, ABC2050:P:52,"
SUBSTITUTE then replaces each ", " with 100 spaces
Using period so you can see them that gives
....................................................................................................ABC2020:D:72....................................................................................................ABC2040:P:52....................................................................................................ABC2050:P:52,
Now TRIM(MID( ,{1,2,3,4}*100,100)) picks out each term & removes the spaces leaving the 4term array
{"ABC2020:D:72";"ABC2040:P:52";"ABC2050:P:52,",""}
Now replace 4 characters of each term starting at the 5th position with nothing
{"ABC2D:72";"ABC2P:52";"ABC2P:52,",""}
Check if the left 5 characters are ABC2P
{False;True;True;False}
1/{False;True;True;False} = {Error;1;1;Error)
Count that = 2