English 中文(简体)
该网络使用什么功能? 体值计算
原标题:What function does .NET NPV() use? Doesn t match manual calculations

我正在使用VB的NPV(PV)功能。 获取一套现金流的专用现金净额。

然而,国家电子计算方法的结果与我人工计算结果不一致(也没有与我的手工结果相匹配的投资全方位数字)。

我正确的手工结果和全国PV(PV)结果在5%之内,但并不相同。

Manually, using the NPV formula: NPV = C0 + C1/(1+r)^1 + C2/(1+r)^2 + C3/(1+r)^3 + .... + Cn/(1+r)^n

The manual result is stored in RunningTotal With rate r = 0.04 and period n = 10

我的相关守则如下:

EDIT:我是否在某个地方有目的地?

    YearCashOutFlow = CDbl(TxtAnnualCashOut.Text)
    YearCashInFlow = CDbl(TxtTotalCostSave.Text)

    YearCount = 1

    PAmount = -1 * (CDbl(TxtPartsCost.Text) + CDbl(TxtInstallCost.Text))
    RunningTotal = PAmount
    YearNPValue = PAmount
    AnnualRateIncrease = CDbl(TxtUtilRateInc.Text)

    While AnnualRateIncrease > 1
        AnnualRateIncrease = AnnualRateIncrease / 100
    End While
    AnnualRateIncrease = 1 + AnnualRateIncrease

      ZERO YEAR ENTRIES
    ListBoxNPV.Items.Add(Format(PAmount, "currency"))
    ListBoxCostSave.Items.Add("$0.00")
    ListBoxIRR.Items.Add("-100")
    ListBoxNPVCum.Items.Add(Format(PAmount, "currency"))
    CashFlows(0) = PAmount
        

    Do While YearCount <= CInt(TxtLifeOfProject.Text)
        ReDim Preserve CashFlows(YearCount)

        CashFlows(YearCount) = Math.Round(YearCashInFlow - YearCashOutFlow, 2)
        If CashFlows(YearCount) > 0 Then OnePos = True


        YearNPValue = CashFlows(YearCount) / (1 + DiscountRate) ^ YearCount
        RunningTotal = RunningTotal + YearNPValue

        ListBoxNPVCum.Items.Add(Format(Math.Round(RunningTotal, 2), "currency"))
        ListBoxCostSave.Items.Add(Format(YearCashInFlow, "currency"))

        If OnePos Then
            ListBoxIRR.Items.Add((IRR(CashFlows, 0.1)).ToString)
            ListBoxNPV.Items.Add(Format(NPV(DiscountRate, CashFlows), "currency"))
        Else
            ListBoxIRR.Items.Add("-100")
            ListBoxNPV.Items.Add(Format(RunningTotal, "currency"))
        End If

        YearCount = YearCount + 1
        YearCashInFlow = AnnualRateIncrease * YearCashInFlow
    Loop

EDIT: Using the following values: Discount Rate = 4% Life of Project = 10 years Cash Flow 0 = -78110.00 Cash Flow 1 = 28963.23 Cash Flow 2 = 30701.06 Cash Flow 3 = 32543.12 Cash Flow 4 = 34495.71 Cash Flow 5 = 36565.45 Cash Flow 6 = 38759.38 Cash Flow 7 = 41084.94 Cash Flow 8 = 43550.03 Cash Flow 9 = 46163.04 Cash Flow 10 = 48932.82

Using the calculator at http://www.investopedia.com/calculator/NetPresentValue.aspx And following the manual "textbook" formula I arrive at the same result:

净现值:225 761.70美元

我似乎无法得到NPV(PV)复制这一结果......它带来217 078.59美元。

我以同样价值的方式对它进行手工操作,以便它们必须使用不同于我的职能......

MSDN网页的例子明确指出,最初的费用应当列入现金流量表。

最佳回答

通常,你将不把眼科基本字典(功能(或至少我们在租赁世界中不出现)上的第一个现金流包括在内。 你们除了第一个现金流外,还会把头一笔现金流值计入你们的净现值。 下面是我以前在计算引擎中做些什么的例子(为了简化实例对重大错误进行核对):

Dim leaseRentalsDiscounted As Double = 0.0

Dim rebatedCashFlows As IEnumerable(Of LeasePayment) = GetLeaseRentalsPaymentStream()

Dim firstFlow As LeasePayment = rebatedCashFlows(0)

Dim doubleStream As Double() = PaymentToDoubleArray(rebatedCashFlows.Skip(1))

If doubleStream.Length > 0 Then
    Dim rate As Decimal = New Decimal(Me.Lease.DiscountRate / 100.0 / 12.0)
    leaseRentalsDiscounted = NPV(rate, doubleStream)
End If

leaseRentalsDiscounted += firstFlow.Amount

Return leaseRentalsDiscounted

这可占您的5%——我知道,我已经讨论过像以前那样的问题。 对我来说,在你所贴出的人工净现公式中,C0的吨数必须放在贴现的下游中,因此我为什么不将其列入功能>。

问题回答

MSDN网页指出,如果你的现金外流始于第一阶段(而不是期末),第一价值必须增加至NPV值,而不列入现金流量表。

你的人工计算表明,你的现金流量(C0)在零时(现值)发生,这表明你应当遵循MSDN网页的建议。

Cory Larson是正确的,部分是......,但我似乎对MSDN文件有误。

问题是,NPV(NPV)功能正在对阵列中第一个(n=0)元素进行贴现,而该功能则从N=1开始。

尽管MSDN文件具体指出,阵列的第一部分应当是初步费用,但并非其职能。

在净捐助国职能中,阵列的第一个要素(如Cry Larson所暗示的)应当是第一个实际现金流量。 然后,在职能恢复后,结果应减去初步费用。

This is because the NPV() function begins with n=1 using the NPV formula: NPV = C0 + C1/(1+r)^1 + C2/(1+r)^2 + C3/(1+r)^3 + .... + Cn/(1+r)^n

在人工公式中,Cn/(1+r)^n,n=0

我认为,MSDN在http://msdn.microsoft.com/en-us/library/microsoft.udiobasic.financial.npv.aspx 应修改如下:

Exclude the initial -70000 value from the array, shift all element down one in index, and decrease the array size by 1. Then add the initial expense (-70000) to the variable NetPVal to arrive at the actual result.

Somebody should like MS know about their OBOB :D (But it s actually a feature, right?)

EDIT: And the section which says " The array must contain at least one negative value (a payment) and one positive value (a receipt)." In not accurate. As Cory Larson pointed out: a negative value is not required in the array (and, in fact, should be left out!)





相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签