Skip to main content
michaels66063507
Participant
February 12, 2017
Question

translate excel code to javascript

  • February 12, 2017
  • 2 replies
  • 732 views

I'm trying to take a credit card payment calculator code from an excel spreadsheet and translate it into javascript. I'm way out of my league. I've reviewed other similar posts and attempted to mimic the information, but I keep getting syntax errors. Here is the code I'm trying to translate:

=IFERROR(ROUNDUP(NPER('Payoff Calculator'!C13/12,-'Payoff Calculator'!C15,'Payoff Calculator'!C12,0),0),"N/A")

Can anyone help? Thanks.

This topic has been closed for replies.

2 replies

Inspiring
February 12, 2017

Do you need the whole statement translated or do you just need the function for the number of payment periods?

michaels66063507
Participant
February 14, 2017

=IFERROR(ROUNDUP(NPER('Payoff Calculator'!C13/12,-'Payoff Calculator'!C15,'Payoff Calculator'!C12,0),0),"N/A")

Sorry, I forgot that the formula referenced cells in a separate worksheet. Here are those references:

C13 = interest rate

C15 = proposed monthly payment

C12 = balance owed

The formula is to calculate how long it would take to pay off a credit card balance given the interest rate and proposed monthly payment.

I guess I need the whole statement translated. I'm hoping my acrobat form will function the same as the excel spreadsheet I have.

As I go through this spreadsheet, I see that there is a second formula for calculating total interest that I would also need:

=IFERROR(((NPER('Payoff Calculator'!C13/12,-'Payoff Calculator'!C14,'Payoff Calculator'!C12,0)*'Payoff Calculator'!C14)-'Payoff Calculator'!C12),"N/A")

C14 = minimum monthly payment

Thank you for any help you can provide.

Legend
February 14, 2017

We're not Excel programmers. I can guess what IFERROR does. There's no real equivalent of IFERROR but you can test for an NaN result, or better, detect and prevent bad calculations (e.g. by testing for division by zero). What ROUNDUP does we can guess, but NPER? That's what we meant by  "Instead of sending us to dig in the documentation of the various Excel functions, can you explain what it is supposed to do, exactly?" What does it do, expressed in simple math rather than Excel code?

try67
Community Expert
Community Expert
February 12, 2017

Instead of sending us to dig in the documentation of the various Excel functions, can you explain what it is supposed to do, exactly?