Here's another one...

A1 = 897

=SUMIF(B4:INDEX(B:B,A1),"CD*",P4:INDEX(P:P,A1))