I have this forumula in a Excel sheet :

`=IF(B$3=0,B$14*B$2*B$6,(1-((1+B$3))^B$6)/LN(1/(1+B$3))*B12*B$2)`

where cells:

B2 = 40000

B3 = 1.0%

B6 = 30

B12 = 10.0%

B14 = 20.0%

The excel produces the following result: 139,834

I started looking at the ‘else’ part seeing as B3 not equal to 1, however I having issues with my calculations in JavaScript. Below is what I got (code is inside a function):

```
var B2 = 40000;
var B3 = 1/100;
var B6 = 30;
var B12 = 10/100;
var B14 = 20/100;
var calc = Math.pow ((1-(1+B3)),B6) / Math.log ( (1 / (1+B3)) * B12 * B2);
return ( calc );
```

What I’m getting back is `1.2071318349401829e-61`

Anyone know where I’m going wrong or how I would go about getting the correct result in JavaScript?

Any help appreciated.

In excel you have

```
1-((1+B$3))^B$6
```

which is the same as

```
1-(1+B$3)^B$6
```

in javascript you have

```
Math.pow ((1-(1+B3)),B6)
```

which is different

Tags: excel, java, javascriptjavascript, jquery