Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:52:28+00:00 2026-06-17T04:52:28+00:00

I have a Goggle Spreadsheet with some data, and I want to write a

  • 0

I have a Goggle Spreadsheet with some data, and I want to write a custom function to use in the sheet, which accepts a range of cells and a delimiter character, takes each cell value, splits it by the delimiter, and counts the total.

For example
Column A has the following values in rows 1-3: {"Sheep","Sheep,Dog","Cat"}
My function would be called like this: =CountDelimitedValues(A1:A3;",");
It should return the value: 4 (1+2+1)

The problem I am having is in my custom script I get errors like

“TypeError: cannot get function GetValues from type Sheep”

This is my current script:

function CountArrayList(arrayList, delimiter) {
  var count = 0;
  //for (i=0; i<array.length; i++)
  //{
    //count += array[i].split(delimiter).length;
  //}

  var newArray = arrayList.GetValues();
  return newArray.ToString();

  //return count;
}

I understand that the parameter arraylist is receiving an array of objects from the spreadsheet, however I don’t know how to get the value out of those objects, or perhaps cast them into strings.

Alternatively I might be going about this in the wrong way? I have another script which extracts the text from a cell between two characters which works fine for a single cell. What is it about a range of cells that is different?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:52:29+00:00Added an answer on June 17, 2026 at 4:52 am

    something like this works :

    function CountArrayList(arrayList) {
    return arrayList.toString().split(',').length
    }
    

    wouldn’t it be sufficient ?

    edit Oooops, sorry I forgot the user defined delimiter, so like this

    function CountArrayList(arrayList,del) {
    return arrayList.toString().split(del).length
    }
    

    usage : =CountArrayList(A1:C1;",")

    NOTE : in this example above it would be dangerous to use another delimiter than “,” since the toString() joins the array elements with commas… if you really need to do so try using a regex to change the commas to what you use and apply the split on that.

    try like this :

    function CountArrayList(arrayList,del) {
    return arrayList.toString().replace(/,/g,del).split(del).length
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom function as a Google Spreadsheet script, which depends on some
I have one Spreadsheet file in my Google Drive which i want to sync
some of the questions i have read http://facebook.stackoverflow.com/questions/1927676/scraping-a-facebook-app-for-data http://facebook.stackoverflow.com/questions/2028940/access-to-facebook-data I want to create a
I have a google form which populates a google spreadsheet (source sheet). I located
I have an Excel spreadsheet of some product data, (just a simple table) that
I have a Google Spreadsheet. In Sheet2 I have some data, and in Sheet3
I have a spreadsheet in google docs that I'd want to integrate in a
I have a cron job that exports some data to CSV every day. Is
I have an opportunity to learn some new tech to write this code. Basic
I have to set lots of triggers in my google spreadsheet to update some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.