Calculating an Interest Rate

Hello! I am fairly experienced in using bubble, but I do not know how to write code and am really struggling to figure out how to make this calculation. I want to determine the interest rate of a loan and I have the monthly payment, number of periods, and loan amount. In excel, this would be done using the =RATE(nper,pmt,pv) function, but I have not figured out any way to do something similar here, even when trying an excel plugin. Any help would be greatly appreciated! Thank you!

You can use javascript to calculate. I have done similar stuff in backend workflows. Check the screenshots for better understanding.



Thank you so much for the response! Do you know of a js function that calculates rate similar to the excel one I listed originally?

I actually found a function, but now I am having trouble saving it to my database. Here is a picture of the code when I run it online. It gets the correct answer, but when I try to save the result or output 1 in bubble, nothing saves. It just shows up as blank. I have set both the output and the result to be numbers. Thanks!