How to call a custom function with multiple arguments in google spreadsheet

Viewed 1355

I have a little problem. I made a custom function for my google spreadsheet but when i try to call i in a cell in my document it just gives me "#ERROR!". Im guessing this is happening because im trying to pass in 2 arguments into the function but for some reason it doesn't like that. Does anyone know why this doesn't work and how i could fix it?

function Test(val, sub) 
{
  return val - sub;
}

Cell input =Test(77, 5) returns "#ERROR!"

1 Answers

I don't see anything wrong with your usage and function, it should work.

I confirmed it by copying your function and testing it.

testing

function showing next to debug

How to correct an #ERROR! error?

Carefully check your formula for accuracy.

Most #ERROR errors are caused by typos on the call of the function or on your actual function itself so you might have to check that.

You can try refreshing the sheet. It sometimes needs a refresh when your function was recently modified.

If it still doesn't work, kindly show the error the cell is showing with the formula. Just hover your pointer over the #ERROR cell and take a screen shot which should be like this:

error

  • By doing this, it will tell us what caused the error. (In this case, I modified the function to induce an #ERROR, changing val to val2)

EDIT:

  • As per TheMaster mentioned in the comment, it is caused by the delimiter ,. And you just confirmed you are from Europe on a comment below, thus this actually applies to you.

Locations using decimal commas:

For locations using commas to denote decimal separators (most European countries), the syntax will follow this structure:

Decimals will be denoted by a comma Arguments in formulas separated by a semi-colon

Thus your function reads 77,5 as Test(77.5, ) which results into #NUM!

Use ; instead.

=Test(77;5)

Reference:

Related