Is there a way to specify one or more arrays an “optional array” in a named function in google sheets?
For example, with built in functions google provides
JOIN(delimiter, value_or_array1, [value_or_array2, …])
where the syntax [value_or_array2, …]
uses the square brackets [ ] indicate optional additional values or arrays.
The function of these would then allow you to add more variables.
As an example, both =HSTACK(a1:b3,d1:d3)
and =HSTACK(a1:b3,d1:d3) work. But creating a custom function named
MY_FUNCTION1 = HSTACK(array1,array2)
will limit the function HSTACK to only 2 variables and generate an error when using
MY_FUNCTION1(a1:b3,d1:d3,f1:f3)
>ERROR: Wrong number of arguments to MY_FUNCTION1. Expected 2 arguments, but got 3 arguments.
Is there a syntax that can be used to allow for optional arrays in custom functions?