Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting Excel Formula to FoxPro
Message
De
19/08/2007 11:23:39
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01249012
Message ID:
01249016
Vues:
21
>Can anyone help me convert this Excel formula to FoxPro.
>
>=RATE(N,-((P+Z)/N),P)*12
>
>Thanks

The main problem here is the rate() function, which doesn't seem to be built-in into Visual FoxPro. As the description in Excel shows, it is calculated by iteration (i.e., trial and error); I think you will have to create your own function, also using iteration. For example, try an interest rate of 0% and 100%; if it turns out that 0% is too little and 100% too much, try with 50%; if this is too much, try with 25%, but if it is too little, try 75%, etc. This is a very simple algorithm; there are probably others that converge (approach the real value) faster.

As an alternative, if you need to do lots of calculations with advanced functions, use Excel Automation, and let Excel do the "dirty work".
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform