Excel ROUND function in Javascript

Excel ROUND function in Javascript

I've got a mathematical formula in Excel, which is the following:

I've got a mathematical formula in Excel, which is the following:

ROUND((B2+C2)*(B55/100)/12;2)

Initial values:

  • B2 = 1000
  • C2 = 0
  • B55 = 0,03

Results (t means time in months). 

Here is my Javascript approach:

(function _calculateRates() {
  var singlePayment = parseInt(1000, 10),
    amount = singlePayment,
    monthlyPayment = parseInt(0, 10),
    investTime = parseFloat(12),
    rate_a = parseFloat(0.03),
    rate_b = parseFloat(0.03),
    investment = monthlyPayment,
    interest = 0;

for (var month = 0; month < investTime; month += 1) { investment = (month === 0) ? 0 : monthlyPayment;

interest = Number(((amount + investment) * (rate_a / 100) / 12).toFixed(2));
amount = Number((amount + interest + investment).toFixed(2));

} console.log('Result: ', amount); })();


As one can see, the result is not correct.

Where can I find the Microsoft Excel algorithm for ROUND() ?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

quicksort Algorithmic in JavaScript

quicksort Algorithmic in JavaScript explain in js

JavaScript Tutorial: if-else Statement in JavaScript

This JavaScript tutorial is a step by step guide on JavaScript If Else Statements. Learn how to use If Else in javascript and also JavaScript If Else Statements. if-else Statement in JavaScript. JavaScript's conditional statements: if; if-else; nested-if; if-else-if. These statements allow you to control the flow of your program's execution based upon conditions known only during run time.

How to Retrieve full Profile of LinkedIn User using Javascript

I am trying to retrieve the full profile (especially job history and educational qualifications) of a linkedin user via the Javascript (Fetch LinkedIn Data Using JavaScript)