From your spreadsheet, I did the calculations to the right of your table.
NOTE: This assumes you have the UNIQUE and FILTER functions available to you.
In cell P10: =TRANSPOSE(UNIQUE(FILTER(C11:C52,C11:C52<>"")))
In cell O11: =UNIQUE(FILTER(D11:D52,D11:D52<>""))
In cells P11:R15 (P11 is the example cell): =SUMPRODUCT(($C$11:$C$52=P$10)*($D$11:$D$52=$O11),($G$11:$G$52))
In cells P20:R20 (P20 is the example cell): =XIRR(INDEX(P11:p15,MATCH(TRUE,P11:p15<>0,0)):INDEX(P11:p15,ROWS(P11:p15)),INDEX($O11#,MATCH(TRUE,P11:p15<>0,0)):INDEX($O11#,ROWS(P11:p15)))
These are the XIRR results, but those are annualized. Since your investments are less than one year, you should un-annualize them:
P21:R21 (P21 is example cell): =(MAX($O11#)-INDEX($O11#,MATCH(TRUE,P11:p15<>0,0)))/365
The # after the range in O is the due to the dynamic array as a result of the UNIQUE/Filter functions.
P22:R22 (P22 is example cell): =(1+P20)^P21-1
This will give the unannualized results.
If you add a total column in S for instance, which is the SUM of the values in P through R, you can get a portfolio XIRR.
If you put the calculations to the left (for the total) and above, you can make it dynamic (as detailed, it is partially dynamic).
EDIT: The smiley emoji recognized in the forum as a colon and the letter P
Moderator Note: You could use ICODE - tags to avoid those ...