You are viewing limited content. For full access, please sign in.

Question

Question

Internal Rate of Return calculation in Forms

asked on November 11, 2020

I've looked through the formulas available in a field's Advanced section and I can't find IRR (Internal Rate of Return) or something similar.  This is often used in Excel spreadsheets and would help me replicate an Excel form in LF Forms.  If anyone here is a financial person using formulas in Forms, would you be able to offer an alternative that has worked for you?

Thanks.

Article and description of IRR function is below.

https://support.microsoft.com/en-us/office/irr-function-64925eaa-9988-495b-b290-3ad0c163c1bc

0 0

Replies

replied on November 12, 2020
0 0
replied on November 12, 2020

While I appreciate your reply, I would have no idea how to go about implementing this in LF Forms.  I suppose it would take some javascript but that's not my forté, so I'm hoping someone on the forum has done something similar and can share their solution.

Thanks!

 

0 0
replied on November 12, 2020

Hi Mike, do you have an example of what fields and calculations you use to calculate IRR in Excel? Can you provide an Excel sheet as an example?
 

0 0
replied on November 12, 2020

Sure, please see the attached file and refer to cell G52 which has the following formula:  =IF(SUM(H38:R44)>0,IRR(G45:R45,-0.99999),0)

 

0 0
replied on November 13, 2020

Hi Mike

After doing some investigation and with the lack of an IRR formula in Forms, it appears the only way to really pull this off would be code this via Javascript unless you went with a different form of calculation to get to a similar result to IRR without it being IRR.

0 0
replied on November 13, 2020

Thanks for looking into this Steve.  I figured that javascript might be the best solution and I do think there's a library of financial formulas available somewhere that can be called by a script function.  I've asked my VAR to take a look at it too...was just hoping someone on here had already done it.

 

Thanks!

0 0
replied on November 16, 2020

We did this for a client, most of the libraries out there do not match up with what you will get out of excel, so do not expect an exact match since IRR is an iterative solution without an exact answer and different libraries do it differently.

 

We did find this repository that tried to copy and get what Excel used. When we adapted it to forms, and it was a fairly close match and the client was happy.  https://github.com/kgkars/tvm-financejs

0 0
replied on November 18, 2020

John.  How did you adapt this for Forms?  My VAR is saying that this was developed for node js, indicating that it is for server side implementations. 

0 0
replied on November 18, 2020

We tried a few functions people have written in pure javascript, but it seems the accuracy is always way off or if trying to correct the accuracy, the while loops run for an eternity.

The general consensus seems to be that it is very difficult to solve for a variable inside of a summation.

This investopedia article begins to step your through the process, then when it gets to "reverse engineering" r (in other words solving for r) it says to just use Excel instead because it is too difficult.
https://www.investopedia.com/ask/answers/022615/what-formula-calculating-internal-rate-return-irr-excel.asp
 

1 0
replied on November 19, 2020

It may have been written for Node, but the function itself you can adapt to forms without any major changes as it solely takes a js array.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.