Create custom function or custom formula in Google Sheets

Here is a sample.

Sample Source Code

function getBMI(height, weight){
  var bmi = 0.0;
  var h2 = (height / 100) * (height / 100);
  bmi = Math.round((10 * weight) / h2) / 10;
  return bmi;
}

Format

function @custom_name (@parameters) {
  // Code
  return @res
}

(1) @custom_name

Custom function name you like.

(2) @parameters

Parameters to be entered. You don’t need to define data type.

And if you want to define multiple parameters, it can split them by “,”.

(3) @res

Responses to be returned.

Leave a Comment