As I indicated, I am not familiar with financial calculations (I kind of assumed that you would be). The help file for the ACCRINT() function suggests the following formula:

ACCRINT=par*rate/frequency*sum(A/NL) I assume the ACCRINTM formula is similar.

Where par is not constant, perhaps the approach would look something like
ACCRINT(j)=par(j)*rate/frequency*sum(A/NL)
=sum(ACCRINT)

If that is correct, I usually find that the easiest way to program that into a spreadsheet is to add a column that will have an ACCRINT() or ACCRINTM() for that row. Then, with each ACCRINT(j) calculated, a simple =SUM() function at the top or bottom to sum those up. I realize that most people want a single cell mega formula rather than use a helper column, but I just have never bothered to become proficient at nesting multiple functions together like that. If that formulation is correct, I will leave it to you to nest it all together.