Hi,
I'm trying to calculate a weighted credit score for the credit ratings I have in my bonds portfolio. The first table represents the different S&P credit ratings (column A) and their arbitrary scores (B).
The second table represents the bonds I have, the investment in each bond (C), their respective credit ratings (D which refers to A) and I use an index match function looking through the first table to get (E) the respective score of each bond. I want to do a weighted average of credit scores so that I can know what is the average credit rating of my entire portfolio. In order to do that, I use sumproduct of column C and column E divided by sum of column C (=22.541) which gives me an average score of 76.5443. I want to be able to do that using an array so that I do not have to do the intermediate step of creating column E.
Is it possible to do something like this? (I know it doesn't work but that's essentially what I'd like to do to skip column E calculations that gets the score line by line.
=SUMPRODUCT($C$2:$C$28,INDEX($A$2:$B$22,MATCH(D2:D28,$A$2:$A$22,0),2))/SUM($C$2:$C$28)
These are the two tables I'm working with:
[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]S&P (A)[/TD]
[TD="width: 64"]Score (B)[/TD]
[/TR]
[TR]
[TD]AAA[/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]AA+[/TD]
[TD="align: right"]95[/TD]
[/TR]
[TR]
[TD]AA[/TD]
[TD="align: right"]90[/TD]
[/TR]
[TR]
[TD]AA-[/TD]
[TD="align: right"]85[/TD]
[/TR]
[TR]
[TD]A+[/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]75[/TD]
[/TR]
[TR]
[TD]A-[/TD]
[TD="align: right"]70[/TD]
[/TR]
[TR]
[TD]BBB+[/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]BBB[/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]BBB-[/TD]
[TD="align: right"]55[/TD]
[/TR]
[TR]
[TD]BB+[/TD]
[TD="align: right"]50[/TD]
[/TR]
[TR]
[TD]BB[/TD]
[TD="align: right"]45[/TD]
[/TR]
[TR]
[TD]BB-[/TD]
[TD="align: right"]40[/TD]
[/TR]
[TR]
[TD]B+[/TD]
[TD="align: right"]35[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]30[/TD]
[/TR]
[TR]
[TD]B-[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD]CCC+[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD]CCC+[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD]CCC-[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]CC[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD]NR[/TD]
[TD="align: right"]0
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 256"]
<colgroup><col span="4"></colgroup><tbody>[TR]
[TD][TABLE="width: 256"]
<colgroup><col><col span="3"></colgroup><tbody>[TR]
[TD]Investment (C)[/TD]
[TD="colspan: 2"]S&P Rating (D)[/TD]
[TD]Score (E)[/TD]
[/TR]
[TR]
[TD]3.7[/TD]
[TD]AA-[/TD]
[TD][/TD]
[TD="align: right"]85[/TD]
[/TR]
[TR]
[TD]1.1[/TD]
[TD]BBB[/TD]
[TD][/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]0.444[/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: right"]75[/TD]
[/TR]
[TR]
[TD]1.1[/TD]
[TD]A-[/TD]
[TD][/TD]
[TD="align: right"]70[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]BBB[/TD]
[TD][/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]1.112[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]0.6[/TD]
[TD]A-[/TD]
[TD][/TD]
[TD="align: right"]70[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]0.77[/TD]
[TD]AAA[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]0.905[/TD]
[TD]AAA[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]0.75[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]BBB[/TD]
[TD][/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]0.635[/TD]
[TD]AAA[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]0.85[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]AA-[/TD]
[TD][/TD]
[TD="align: right"]85[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]A-[/TD]
[TD][/TD]
[TD="align: right"]70[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]1.1[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]AA-[/TD]
[TD][/TD]
[TD="align: right"]85[/TD]
[/TR]
[TR]
[TD]0.25[/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: right"]75[/TD]
[/TR]
[TR]
[TD]0.225[/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: right"]75[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]AAA[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]22.541[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]76.5443
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="colspan: 2"][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I'm trying to calculate a weighted credit score for the credit ratings I have in my bonds portfolio. The first table represents the different S&P credit ratings (column A) and their arbitrary scores (B).
The second table represents the bonds I have, the investment in each bond (C), their respective credit ratings (D which refers to A) and I use an index match function looking through the first table to get (E) the respective score of each bond. I want to do a weighted average of credit scores so that I can know what is the average credit rating of my entire portfolio. In order to do that, I use sumproduct of column C and column E divided by sum of column C (=22.541) which gives me an average score of 76.5443. I want to be able to do that using an array so that I do not have to do the intermediate step of creating column E.
Is it possible to do something like this? (I know it doesn't work but that's essentially what I'd like to do to skip column E calculations that gets the score line by line.
=SUMPRODUCT($C$2:$C$28,INDEX($A$2:$B$22,MATCH(D2:D28,$A$2:$A$22,0),2))/SUM($C$2:$C$28)
These are the two tables I'm working with:
[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]S&P (A)[/TD]
[TD="width: 64"]Score (B)[/TD]
[/TR]
[TR]
[TD]AAA[/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]AA+[/TD]
[TD="align: right"]95[/TD]
[/TR]
[TR]
[TD]AA[/TD]
[TD="align: right"]90[/TD]
[/TR]
[TR]
[TD]AA-[/TD]
[TD="align: right"]85[/TD]
[/TR]
[TR]
[TD]A+[/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]75[/TD]
[/TR]
[TR]
[TD]A-[/TD]
[TD="align: right"]70[/TD]
[/TR]
[TR]
[TD]BBB+[/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]BBB[/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]BBB-[/TD]
[TD="align: right"]55[/TD]
[/TR]
[TR]
[TD]BB+[/TD]
[TD="align: right"]50[/TD]
[/TR]
[TR]
[TD]BB[/TD]
[TD="align: right"]45[/TD]
[/TR]
[TR]
[TD]BB-[/TD]
[TD="align: right"]40[/TD]
[/TR]
[TR]
[TD]B+[/TD]
[TD="align: right"]35[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]30[/TD]
[/TR]
[TR]
[TD]B-[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD]CCC+[/TD]
[TD="align: right"]20[/TD]
[/TR]
[TR]
[TD]CCC+[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD]CCC-[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]CC[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD]NR[/TD]
[TD="align: right"]0
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 256"]
<colgroup><col span="4"></colgroup><tbody>[TR]
[TD][TABLE="width: 256"]
<colgroup><col><col span="3"></colgroup><tbody>[TR]
[TD]Investment (C)[/TD]
[TD="colspan: 2"]S&P Rating (D)[/TD]
[TD]Score (E)[/TD]
[/TR]
[TR]
[TD]3.7[/TD]
[TD]AA-[/TD]
[TD][/TD]
[TD="align: right"]85[/TD]
[/TR]
[TR]
[TD]1.1[/TD]
[TD]BBB[/TD]
[TD][/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]0.444[/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: right"]75[/TD]
[/TR]
[TR]
[TD]1.1[/TD]
[TD]A-[/TD]
[TD][/TD]
[TD="align: right"]70[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]BBB[/TD]
[TD][/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]1.112[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]0.6[/TD]
[TD]A-[/TD]
[TD][/TD]
[TD="align: right"]70[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]0.77[/TD]
[TD]AAA[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]0.905[/TD]
[TD]AAA[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]0.75[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]BBB[/TD]
[TD][/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]0.635[/TD]
[TD]AAA[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]0.85[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]AA-[/TD]
[TD][/TD]
[TD="align: right"]85[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]A-[/TD]
[TD][/TD]
[TD="align: right"]70[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]1.1[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]AA-[/TD]
[TD][/TD]
[TD="align: right"]85[/TD]
[/TR]
[TR]
[TD]0.25[/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: right"]75[/TD]
[/TR]
[TR]
[TD]0.225[/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: right"]75[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]BBB+[/TD]
[TD][/TD]
[TD="align: right"]65[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]A+[/TD]
[TD][/TD]
[TD="align: right"]80[/TD]
[/TR]
[TR]
[TD]0.5[/TD]
[TD]AAA[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]22.541[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]76.5443
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="colspan: 2"][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]