Let Column A = [D, A, A, B, A, C, B, D, D, D, E, E]
Let Column B = [A, B, C, D]
=FILTER(A1:A10, B1:B4=$B1)
The problem is, when you drag and apply the above formula, because there are multiple results, you can't necessarily use that right away and have to do it separately and manually like
C1=FILTER(A1:A10, B1:B4=B1)
C4=FILTER(A1:A10, B1:B4=B2)
C6=FILTER(A1:A10, B1:B4=B3)
C7=FILTER(A1:A10, B1:B4=B4)