diff options
Diffstat (limited to 'helpcontent2/source/text/sbasic/shared/03140006.xhp')
-rw-r--r-- | helpcontent2/source/text/sbasic/shared/03140006.xhp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/03140006.xhp b/helpcontent2/source/text/sbasic/shared/03140006.xhp new file mode 100644 index 000000000..94b4b9bbd --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03140006.xhp @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<helpdocument version="1.0"> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + +<meta> + <topic id="textsbasicshared03140006xml" indexer="include" status="PUBLISH"> + <title id="tit" xml-lang="en-US">NPV Function [VBA]</title> + <filename>/text/sbasic/shared/03140006.xhp</filename> + </topic> +</meta> + +<body> + + +<section id="npv"> +<bookmark xml-lang="en-US" branch="index" id="bm_id3150499"> + <bookmark_value>NPV function</bookmark_value> +</bookmark> + + +<paragraph id="hd_id3150499" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03140006.xhp" name="NPV Function [VBA]">NPV Function [VBA]</link></paragraph> +<paragraph id="par_id3151384" role="paragraph" xml-lang="en-US">Calculates the Net Present Value of an investment, based on a supplied discount rate, and a series of deposits and withdrawals.</paragraph> +</section> +<embed href="text/sbasic/shared/00000003.xhp#vbasupport"/> +<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> +<bascode> +<paragraph id="par_id3143267" role="bascode" localize="false" xml-lang="en-US">NPV (Rate as Double, Values() as Double)</paragraph> +</bascode> +<embed href="text/sbasic/shared/00000003.xhp#functvalue"/> +<paragraph id="par_id3150669" role="paragraph" localize="false" xml-lang="en-US">Double</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functparameters"/> +<paragraph id="par_id06142017042024114" role="paragraph" xml-lang="en-US"><emph>Rate</emph> is the discount rate for a period.</paragraph> +<paragraph id="par_id061420170420248911" role="paragraph" xml-lang="en-US"><emph>Values()</emph> is an array that represent deposits (positive values) or withdrawals (negative values).</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#errorcode"/> +<embed href="text/sbasic/shared/00000003.xhp#err5"/> +<embed href="text/sbasic/shared/00000003.xhp#functexample"/> +<bascode> +<paragraph id="par_id230720172234183296" role="bascode" localize="false" xml-lang="en-US">REM ***** BASIC *****</paragraph> +<paragraph id="par_id230720172234189989" role="bascode" localize="false" xml-lang="en-US">Option VBASupport 1</paragraph> +<paragraph id="par_id230720172234184331" role="bascode" localize="false" xml-lang="en-US">Sub ExampleNPV</paragraph> +<paragraph id="par_id230720172234186787" role="bascode" localize="false" xml-lang="en-US"> Dim r As Double</paragraph> +<paragraph id="par_id230720172234187720" role="bascode" localize="false" xml-lang="en-US"> Dim pValues(5) as Double</paragraph> +<paragraph id="par_id230720172234182042" role="bascode" localize="false" xml-lang="en-US"> pValues(0) = 100</paragraph> +<paragraph id="par_id230720172234187602" role="bascode" localize="false" xml-lang="en-US"> pValues(1) = 100</paragraph> +<paragraph id="par_id230720172234186650" role="bascode" localize="false" xml-lang="en-US"> pValues(2) = 100</paragraph> +<paragraph id="par_id230720172234184123" role="bascode" localize="false" xml-lang="en-US"> pValues(3) = -300</paragraph> +<paragraph id="par_id230720172234182595" role="bascode" localize="false" xml-lang="en-US"> pValues(4) = 100</paragraph> +<paragraph id="par_id230720172234183081" role="bascode" localize="false" xml-lang="en-US"> pValues(5) = 100</paragraph> +<paragraph id="par_id230720172234196719" role="bascode" localize="false" xml-lang="en-US"> r = 0.06</paragraph> +<paragraph id="par_id230720172234195414" role="bascode" localize="false" xml-lang="en-US"> p = NPV( r, pValues)</paragraph> +<paragraph id="par_id230720172234199811" role="bascode" xml-lang="en-US"> Print p ' returns 174,894967305331</paragraph> +<paragraph id="par_id230720172234199988" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph> +</bascode> + +<section id="relatedtopics"> +<paragraph id="par_id061420170153186192" role="paragraph" xml-lang="en-US"><link href="text/scalc/01/04060119.xhp#bm_id3149242">NPV function in CALC</link></paragraph> +<embed href="text/sbasic/shared/00000003.xhp#VBA-Financial"/> +</section> +</body> + +</helpdocument> |