I am looking for a way to add up cells under a name. For instance, I am trying to tally all of the assists the character "Annie" got in a few different games of League of Legends.

Spreadsheet image

I am looking for a way to search for a name (which shows up multiple times) and then count adjacent cells.

  • Not sure I understand - could you specify what your expected result would be for "Annie"? Jan 27 '15 at 9:03



and then add for other columns if required.


I think the use of a little script is best served here.


function getAssists(range, name, skill) {
  var ss = SpreadsheetApp.getActive();
  var data = ss.getRange(range).getValues();
  var objTypes = {"Kills": 1, "Assist": 2};

  var totalAssists = 0, type = objTypes[skill];
  for(var i = 0, iLen = data.length; i < iLen; i++) {
    for(var j = 0, jLen = data[0].length; j < jLen; j++) {
      if(data[i][j] === name) {
        totalAssists += data[i+type][j];
  return totalAssists;


The first parameter of the custom function (range) determines which data range to use and the second (name) which name to look for. The last will select the skill to sum up. If the name has been found, then add the corresponding skill to the total.


enter image description here


I've created an example file for you: Total Assists for Annie
Make a copy or add the code under Tools > Script editor from the menu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.