Suppose, there are values such as 1,A, 2,B, 3,D in certain cells. My intention is to add 1,2,3 (LHS) separately and A,B,D (RHS) separately. To achieve that, I have written certain custom function in "App script":

function GetNumber (number, alphabet) { return number; }

Now, how can I pass 1,A to the GetNumber() as 2 arguments so that, the logic works?
I tried SPLIT, but it doesn't work:
=GetNumber(SPLIT(C1,",")) // C1 is a column cell

Though I am using Google sheet, MS-Excel equivalent may also help.


Part of your problem is that SPLIT, when used as an argument to a function, returns a string. Say your C1 cell contains the text 1,C. Your formula

=GetNumber(SPLIT(C1, ","))

is actually equivalent to


If you are somewhat familiar with JavaScript, you could instead to the split operation within your function code:

function GetNumber(input) {
  const [number, alphabet] = input.split(",");
  return number;

You could then call your function with


and it should return 1.

Explanation (with links to relevant JavaScript documentation):

The input.split(",") splits the input argument at ,, returning an array of the two parts: ["1", "C"].

const [number, alphabet] is a destructuring assignment, picking out the two parts of the array, storing them in separate variables.

This makes it possible for our function to return the desired variable: return number.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.