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

  • SEARCH
  • Home
  • 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 8317447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:36:24+00:00 2026-06-08T21:36:24+00:00

This one might be a bit basic and easy to answer, but I’ve been

  • 0

This one might be a bit basic and easy to answer, but I’ve been pulling out my hair for a while now!

I’ve built the following code – which is semi-pseudo as I can’t find the right way to make things work!

var s = "Test";

function onEdit(event)
{
  var ss = event.source.getActiveSheet();
  var r = event.source.getActiveRange();
  if (ss.getName() == s)
  {
    results = {"Currently On": 0, "Next Up": 0, "On Hold": 0, "Waiting on someone else":     0, "zDone": 0};
    last = ss.getMaxRows();
    start = ss.getRange("F3:"+last).getValues();
    var output = "J11";
    for (x=0;x<start.length;x++)
    {
     results[start[x]]++;
    }

    for (y=0;y<results.length;y++)
    {
      row = ss.getRow(output);
      row.value = results[y];
      output++;
    }
  }
}

I’ve got an example of the data in this image data example

The basic idea is to run through all the possible categories of each task and keep a numeric list on the side of how many of each there are. I’d also like to make it dynamic (so I don’t have to hard code in the list of categories) but I’m more interested in just making it work for the moment.

The Google Apps debugger is very frustrating!

Thanks for your help all!

  • 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-08T21:36:26+00:00Added an answer on June 8, 2026 at 9:36 pm

    Firstly, this particular use case would be easily achievable with a spreadsheet formula, eg:

    =QUERY(A2:F;"select F, count(A) where F != '' group by F label count(A) 'Count'";1)
    

    but there may be a reason why you want to do this with GAS.

    So secondly, this is where I think there may be some syntax issues:

    last = ss.getMaxRows();
    

    I would just use var last = ss.getLastRow() here.

    start = ss.getRange("F3:"+last).getValues();
    

    The range reference would evaluate to something like “F3:100”, which is a valid reference in GSheets (don’t know about whether GAS can handle it), but nevertheless you really want something like “F3:F100”, so I would use var start = ss.getRange("F3:F"+last).getValues();.

    results[start[x]]++;
    

    When you create an array from a getValues() call it is a 2D array, so you would need to use results[start[x][0]]++;.

    With the next loop and the output variable, I must admit I’m a bit lost with what you’re doing there. How did you want your result table laid out?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might be an easy one, but I'm not really experienced with sql. I
This question might belong on one of the other trilogies, but it sorta seemed
This might be a simple one, but since I don't have much knowledge about
I already asked a similar question but this one is a bit different/specific: I'm
I'm at a bit of a loss on this one and haven't been able
This one might be a little confusing. I'm using AMCharts with rails. Amcharts comes
I really nead to ask you this one, many of you might think it's
Please don't crucify me for this one. I decided it might be good to
This might be a really trivial one. Is File storage OS dependant ? Why
anyone shed any light as to why this might be happening for one user

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.