1

I am trying to create a script that will sum all values in a given cells (for example G1) on all and future tabs. I have come across sum3D (answer from Mike Steelson - link below) which seems to do the trick but it does not automatically update. You have to delete the text and re-type the formula. I would like for the cell to update whenever the data changes on the tabs.

Thank you in advance for your help. Below is a link to the original creator I believe. https://stackoverflow.com/a/73102896/19997363

function sum3D() {
  const ss = SpreadsheetApp.getActiveSpreadsheet()
  var shs = ss.getSheets();
  var rng = ss.getActiveSheet().getActiveCell().getA1Notation()
  var sh1 = ss.getSheetByName('b').getIndex()
  var sh2 = ss.getSheetByName('e').getIndex()
  var result = 0
  for (var i = sh1; i < sh2; i++) {
    result += shs[i].getRange(rng).getValue()
  }
  return result
}
  • I apologize for not linking it. This was my first post and I am unfamiliar with the options, I tried to tag the person but it didn't look like that was a feature. I was going to reply on the original thread but it said avoid asking for help, clarifications on someone else's post so I wasn't sure what to do. – thearchitect Sep 15 '22 at 00:05
  • It's ok to ask new questions. Your question is linked as a duplicate and I believe the answers there will satisfy your needs. Do read through them – TheMaster Sep 15 '22 at 00:08
  • If you're having trouble implementing a solution in the duplicate or don't understand a solution provided, ask a new specific question with the part you're having trouble with. – TheMaster Sep 15 '22 at 00:09

0 Answers0