Last active
December 11, 2015 10:58
-
-
Save ghalimi/4590502 to your computer and use it in GitHub Desktop.
FVSCHEDULE Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function FVSCHEDULE(principal, schedule) { | |
// Initialize future value | |
var future = principal; | |
// Apply all interests in schedule | |
for (var i = 0; i < schedule.length; i++) { | |
// Return error if schedule value is not a number | |
if (isNaN(schedule[i])) return '#VALUE!'; | |
// Apply scheduled interest | |
future *= 1 + schedule[i]; | |
} | |
// Return future value | |
return future; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment