I have a Google spreadsheet consisting of different months on each tab.  Every month, I add a new tab and another 50-75 rows.  There are many tabs.  There is a cell on each row which calls a custom function, like this:

    =myFunction(A1)

The problem I am having is that I am getting the following error:

>error: Script invoked too many times per second for this Google user account.

What can I do to prevent this error from occurring?

Is the problem because there are too many tabs, or too many rows per tab?

There must be a way to prevent the function from having to run more than once. 


----------


 

Here is a shortened version of the function that is called:

    function myFunction(expense) {
    if (
      InStr(1,expense,"CPC SCP") ||
      InStr(1,expense,"CPC/SCP") ||
      InStr(1,expense,"xxxx")
      )
      { category = "5530 - Postage Expense" } 
     
      else if (
      InStr(1,expense,"PRE-AUTHORIZED PAYMENT") ||
      InStr(1,expense,"xxx ")
      )
      { category = "9999 - Payment" } 
      
      else if (
      InStr(1,expense,"PURCHASE INTEREST") ||
      InStr(1,expense,"RETURNED PAYMENT FEE") ||
      InStr(1,expense,"xxxx")
      )
      { category = "5070 - Bank Charges" } 
    
    else { category = "Not Sure" }
        
    return category;  
    
    }