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 7934353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:37:24+00:00 2026-06-03T21:37:24+00:00

I have some trouble with a spreadsheet: as said in the title, I put

  • 0

I have some trouble with a spreadsheet: as said in the title, I put in a column a formula which is calling a custom script based on the value of another cell, but when I modify this other cell, the formula does not update… This seems to work with standard formulas, but, in my cell calling my script:

  • If I try to add a blank in the fomula cell, the result is still not updated.
  • If I clear the formula cell, and re-type the formula, it’s still showing the old value.
  • If I copy paste the formula cell in another one, the new cell is up-to-date.

Here is my script. If few words: for given ‘company’ parameter, it search for all rows matching this criterion and store the 3rd column cell in a variable, finally returned ( so return the last value ):

function getLastStatut(company) {
  var values = SpreadsheetApp.getActiveSheet().getDataRange().getValues();

  var out = "not found";
  var row;
  for(i in values){
    row = values[i];
    if(row[1]==company){
      out = row[2];
    }
  }
  return out;
}

And for example:

  • A1 : Date
  • A2 : Test
  • A3 : Running
  • A4 : =getLastStatut(B1)

So A4 display “Running”, but if I change A3, it still shows “Running”, whereas it should display the value of A3.

Is this a bug or is there something I’m doing wrong? Any help is welcome.

Alexis

  • 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-03T21:37:25+00:00Added an answer on June 3, 2026 at 9:37 pm

    The problem is with the caching “feature” for custom functions. I explain it in this other thread, please read.

    But the bottom line here is, a custom function should not access data that is not static, all variable information should be passed as parameter. In your case, the whole data set should be a parameter of your script. Custom functions should never get any range at all.

    //getting values like this is wrong (for a custom function)
    var values = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some trouble handling custom C++ exceptions when calling from Cython. My situation
I'm have some trouble with the fulltext CONTAINS operator. Here's a quick script to
I have some trouble with dbus-send when using a{sv} Calling a method with in_signature='a{ss}'
i have some trouble to connect an link inside an dijit.dialog. Iam calling an
I'm having some trouble reading from an Excel spreadsheet in C#. I have this
I have some trouble when trying to update a table by looping cursor which
I have some trouble when using SPUtility.SendEmail method in a custom workflow. private void
I am have some trouble specifying a custom icon in my WPF applicaion. I
i have some trouble with the custom shapes in corona. Here is my code
I have some trouble with my trac installation (version 11.4). What should I do

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.