Wednesday, July 10, 2013

Google Spreadsheet Calculating Work Overload


( by Ben )


I hope someone is able to help - I will try and be as clear as I can with my question.

I am trying to make a basic machine capacity table in Google Spreadsheet, but need some help on how to do it. The concept is simple but I do not know how to make an equation fit it.

Please see this link for the Spreadsheet:

The WEEK NO. column is the number of the week in the year
The JOBS [WEEKS] column is how much work there is to do in weeks that needs to be started.
The MACHINIST column is how many machinist's are available that week.

What I am trying to do is essentially "count backwards" so I can see where I am overloaded with work. For example Week 32 there is 3.4 weeks of work but only machinists. Which means that you need to do the 1.4 overload the week before, but that means that you can only do 0.6 of week 31's work because there is also only machinists in that week. And all the work in week 31 will have to be pushed back again. So on and so forth.

The maximum amount of jobs that can be do in any given week is restricted by how many machinists are in that week, any overload needs to be done the week before otherwise it will be late. (1 machinist can do 1 weeks of jobs).

I may be approaching this problem the wrong way, so any suggestions will be appreciated. The shared Spreadsheet is editable so please feel free to change the data if you need to.

I look forward to any responses.

Many thanks,


Have a look at the screenshot of my spreadsheet having solution:

I have the following custom formula in Cell D2:

This custom formula works on the basis of following script:

function kishan()
  if (arguments.length < 1)
    return "#NA Please input range";
  else if (arguments.length > 1)
    return "#NA Input Can't be more than one arguement";
  var values = arguments[0];
  var returnArray = [];
      var temp = values[i][0] - values[i][1];
      values[i][0] = values[i][1];
      values[i-1][0] = values[i-1][0]+temp;
    returnArray[i] = [values[i][0]];
  return returnArray;

Put the above code in your script editor in your spreadsheet.

And If you are not much familiar with scripts then check out the following link: 

I hope the above solution will help you, and if you need more help then please do comment below on this blog itself, I will try to help you out.

I also take up private and confidential projects:
If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: 


No comments:

Post a Comment