How to Implement Excel IRR Function in Power Apps Using Power Fx
Question details
The user wants to reproduce Excel's Internal Rate of Return (IRR) calculation in Power Apps using Power Fx.

- Product
- Excel / Power Apps
- Device & OS
- not provided
- Scenario
- Performing financial modeling or cash flow analysis requiring IRR calculations natively within a Power Apps environment.
- Observed behavior
- Excel does not publish the exact internal IRR algorithm, requiring a custom numerical method implementation in Power Fx to calculate the discount rate that zeroes out the Net Present Value (NPV).
Gather your periodic cash flow data and understand that custom Power Fx calculations may yield slightly different results from Excel due to Microsoft's proprietary and undocumented IRR algorithm.
Implement a Numerical Solver for IRR in Power Fx
Since the exact Excel algorithm is undocumented, use standard numerical methods like Newton-Raphson or Bisection to find the discount rate that makes the Net Present Value (NPV) zero.
IRR is defined as the discount rate 'r' where NPV(r) = SUM(CashFlow_t / (1+r)^t) = 0.
Because Power Fx lacks a native IRR function, you must build a custom formula that iterates through potential rates starting from an initial guess until it reaches a defined tolerance.
Set up your cash flow array in Power Apps using a Collection and define an initial guess for the rate, typically 10% (0.1).
Write a Power Fx formula using the ForAll or Sum functions to calculate the Net Present Value based on a variable discount rate.
Set up a loop or recursive structure to adjust the discount rate using the Newton-Raphson method or bisection until the NPV is sufficiently close to zero.
Add logic to stop the calculation if it doesn't converge within a specific number of iterations (e.g., 20 steps) to prevent performance issues.

Perform Financial Calculations Easily with WPS Office
Instead of building complex custom solvers in Power Apps, you can perform accurate financial modeling and calculate IRR directly using WPS Spreadsheet. It offers a familiar interface and seamless compatibility with Microsoft Excel formulas for free.
- 1. Open WPS Spreadsheet: Launch WPS Office and create a new Spreadsheet document or open your existing financial model.
- 2. Use the IRR function: Select a cell and type =IRR(), then select the range of cells containing your cash flows.
- 3. Save and export: Save your document in .xlsx format to ensure full compatibility with Microsoft Office users.

Frequently Asked Questions
Why does my Power Apps IRR calculation differ from Excel?
Excel uses a proprietary, undocumented algorithm for its IRR function. When recreating it with standard numerical methods like Newton-Raphson in Power Apps, slight variations in convergence criteria and initial guesses can cause minor differences in the final result.
Can I use the native Excel IRR function directly in Power Apps?
Power Fx currently does not have a native IRR function. You either need to build a custom numerical solver within Power Apps or use a Power Automate flow to pass the data to an Excel file, calculate it there, and return the result to your app.
What is the best initial guess for an IRR calculation?
A standard initial guess is 0.1 (or 10%). If your cash flows have multiple sign changes, there could be multiple internal rates of return, so you may need to adjust the guess closer to your expected rate to find the correct solution.




