# Future value of a single sum calculator

Posted in: Capital budgeting techniques (calculators)

Present value:

Number of periods:

Interest rate per period:

Skip to content
# Future value of a single sum calculator

function myFunction()
{
var x;
var y;
var z;
var errors;
x=pv.value;
y=nop.value;
z=ir.value;
x=x.replace(/[^0-9.]/g, '');
y=y.replace(/[^0-9.]/g, '');
z=z.replace(/[^0-9.]/g, '');
x=parseFloat(x);
y=parseFloat(y);
z=parseFloat(z);
futurevalue=x*Math.pow(1+z/100, y)
if (x=="0")
{
document.getElementById("error1").innerHTML="This field cannot be zero.";
errors=true;
}
else if (pv.value=="")
{
document.getElementById("error1").innerHTML="This field cannot be blank.";
errors=true;
}
else {
document.getElementById("error1").innerHTML="";
}
if (y=="0")
{
document.getElementById("error2").innerHTML="This field cannot be zero.";
errors=true;
}
else if (nop.value=="")
{
document.getElementById("error2").innerHTML="This field cannot be blank.";
errors=true;
}
else {
document.getElementById("error2").innerHTML="";
}
if (z=="0")
{
document.getElementById("error3").innerHTML="This field cannot be zero.";
errors=true;
}
else if (ir.value=="")
{
document.getElementById("error3").innerHTML="This field cannot be blank.";
errors=true;
}
else {
document.getElementById("error3").innerHTML="";
}
if (errors==true)
{
document.getElementById("futvalue").innerHTML="";
return false;
errors=false;
}
if (isNaN(futurevalue))
{
futurevalue = "0";
}
if (futurevalue == Number.POSITIVE_INFINITY || futurevalue == Number.NEGATIVE_INFINITY)
{
futurevalue="0";
}
futurevalue = parseFloat(futurevalue);
futurevalue = Math.round(futurevalue*100)/100;
futurevalue = futurevalue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
document.getElementById("loading").style.visibility = "visible";
setTimeout(function(){Timer1()},1200);
}
function Timer1() {
document.getElementById("loading").style.visibility = "hidden";
document.getElementById("futvalue").innerHTML="Future value: "+"$"+futurevalue;
}
function reset()
{
pv.value="";
nop.value="";
ir.value="";
document.getElementById("futvalue").innerHTML="";
document.getElementById("error1").innerHTML="";
document.getElementById("error2").innerHTML="";
document.getElementById("error3").innerHTML="";
}

Menu

Find

Posted in: Capital budgeting techniques (calculators)

Present value:

Number of periods:

Interest rate per period:

Copyright 2012 - 2021. Accounting For Management

## Leave a comment