Google's help center [says][1]:

 > *Script invoked too many times per second for this Google user account.* This indicates that the script began executing too many times in a short period. It most commonly occurs for custom functions that are called repeatedly in a single spreadsheet. To avoid this error, code your custom functions so that they only **need to be called once per range of data**, as explained in the guide to custom functions.

I'm assuming this is because calling a custom function takes a lot of memory (going through the existing functions to see if it's there, then turning back to execute it). You need to make it so that it will be only called *once* instead of 2000 times. The fact that you added `sleep()` did nothing because you are always `return`ing before that statement, but even if you weren't it would only make it worse because it doesn't sleep between invocations, but rather at *every* invocation.

Your code is a little funny, and I was especially amused at the `else` clause at the end. I couldn't find a pattern for your ranges so I just stored everything in two arrays and wrote the code that way. In addition, for the code to only be invoked once I made it so that you have to choose what range you want (keep it to only 1 column and multiple rows). Check it out:

    function assignBoxNumber(range){
      var maxes = [1, 72, 73, 126, 127, 203, 207, 270, 334, 434, 498, 561, 628, 692, 792, 873, 956, 1020];
      var vals = ["", "1", "1 and 2", "2", "2 and 3", "3", "", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"];
      //if (maxes.length != vals.length) {return "you fucked up"; }
      var length = range.length, output = new Array(length);
      var i, obj, key;
      for (var row = 0; row < length; row++)
      {
        obj = range[row][0];
        key = "";
        for (i = 0; i < maxes.length; i++)
        {
          if (obj < maxes[i]){ key = vals[i]; break;}
        }
        output[row] = (key == "") ? "Error: No box location!" : key;
      }
      return output;
    };

Note that the parameter is a **range**. Meaning that it will be in the format of `U1:U20` for instance, but it's NOT a string. The first number is the first cell (in the example `U1`), the second is the last cell (`U20`). You can also select the region you want to help you get the range:

![enter image description here][2]

But obviously for 2k+ rows you want to write it in. So call the function like `=assignBoxNumber(<first cell>:<last cell>)`

I tested it on 1,021 rows and it worked perfectly. There shouldn't be a problem now that there's only 1 call to the custom function.


  [1]: https://developers.google.com/apps-script/guides/services/quotas
  [2]: https://i.sstatic.net/AGaBU.png