如何计算内部收益率(IRR)? [英] How to calculate internal rate of return (IRR)?

查看:244
本文介绍了如何计算内部收益率(IRR)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我修改了原来的问题....



我在DataGridView中有一个列,其中包含税前现金流值。

有人可以帮我计算内部收益率(内部收益率)吗?



这是我到目前为止所做的,但在尝试时收到错误计算IRR函数:



错误:'Double'类型的值无法转换为'1维数组的Double。此错误是指IRR功能中的val。



非常感谢您的帮助!请考虑一下,我是新手,只是开始编写VB,谢谢!!



我尝试过:



I've modified my original question....

I have a column in a DataGridView which includes before tax cash flow values.
Could someone please help me to calculate the IRR (Internal Rate of Return)?

Here is what I have done so far, but getting an error when trying to calculate the IRR function:

Error: Value of type 'Double' cannot be converted to '1-dimensional array of Double. this error refers to "val" in the IRR function.

Thanks so much for your help! Please consider that, I am new and just start coding VB, thanks !!

What I have tried:

Dim prec As String  "###,##0.00"
Dim guess As Double=0.1

For i = 0 to DataGridView1.Rows.Count -1
    For j = 0 to DataGridView1.Rows.Count -1

        Dim value(j) As Double
        Dim val As Double
        value(j) = DataGridView1.Rows(i).Cells(0).Value

        value(j) = val
    
        Dim cal As Double = IRR(val,guess) * 100

        MsBox("IRR = " & Format(cal, CStr(prec)) & " % ")
        Text1.Text=cal
    Next
Next

推荐答案

你这是错误的方式。 DGV用于显示数据。最简单的方法是将网格绑定到数据源。



此数据源是您所缺少的。这是您使用适当的数据类型创建并保存和处理数据的结构。这就是你应该完成的所有计算。



DGV可以绑定到您的数据结构以显示其中的数据。这样,您就不必担心列并将DGV单元格中的内容转换为可用的内容。
You're going about this the wrong way. The DGV is there to display data. The easiest way to do that is to bind the grid to a data source.

This data source is what you're missing. This is a structure you create and holds and handles your data using the proper data types for your calculations. This is what all of your calculations should be done on.

The DGV can be bound to your data structure to show the data in it. That way, you don't have to worry about columns and converting what's in a DGV cell to something usable.


这篇关于如何计算内部收益率(IRR)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆