In last post (Excel FISHER Function in Apex Salesforce), we gone through the code for Excel FISHER function in apex. In this post we will see Excel FISHERINV function in apex salesforce. Basically FISHERINV function returns the inverse of the Fisher transformation.
Syntax of FISHERINV function is as follows in Excel
- FISHERINV(y)
- WHERE y is required
- Value of y should be numeric.
APEX CODE
Let’s see the code for Excel FISHER function in Apex Salesforce.
1 2 3 4 5 6 7 8 9 10 11 |
* @author : 799 The Coder * @date : 21 Aug 2017 * @description : This method returns Fisher transformation at x, equivalent to FISHER(x) excel function * @param : Decimal y * @return : Decimal (fisherINV) */ public static Decimal fisherINV(Decimal y){ Decimal fisherInv = 0.0; fisherInv = (Math.exp(2*y)-1)/(Math.exp(2*y)+1); return fisherInv; } |
Above code can be added in any apex class, after adding this code we can use it as per our requirement. Lets test it from developer console. Go to developer console and in Execute anonymous window paste the below code.
1 2 3 4 |
Decimal y = 0.972955; Decimal fisherInv = ExcelFormulaUtils.fisherINV(y); // Use your class name instead of ExcelFormulaUtils in above statement. System.debug('######> fisherInv = ' + fisherInv); |
After executing above code snippet you will get below output.
Thank you for reading 🙂