Everyone should love this - how to calculate credit card interest???

Is there any built in function for it in VB, Excel etc.?

If I buy a goods on my credit card costing $ A, if APR is r%, if minimum balance is $ m per month and if I pay back $ p1 in 1st month, $ p2 in 2nd month,..., $ pn in n th month what will be my interest and principle amount paid back every month?

Can anyone provide a formula for this??

Lots of thankx