Excel INTERCEPT function in Apex Salesforce

By | August 7, 2017

Hello awesome Developers!!! This post will save your time if you are going to implement Excel INTERCEPT function in apex salesforce. In my previous post of excel function (Excel LINEST function in Apex Salesforce), we coded for LINEST function of excel.

Before we jump to code, lets have a quick view of INTERCEPT function.

Syntax of Intercept function is as follows in Excel

INTERCEPT(known_y’s, known_x’s)

WHERE Known_y’s  and Known_x’s  both are Required.

We must ensure that Known_y’s and Known_x’s size is same.

The above code snippet is a static method, you can put it any helper/utility class in salesforce.  See below a demo call to this method from developer console.

The output of the above code snippet from developer console will be below

INTERCEPT = 0.0483870967741935483870967741935484

Use it and save your time, in your saved time do some other creative coding 🙂 !!!

Leave a Reply

Your email address will not be published. Required fields are marked *