Google Sheets Map Function – Is There a Map Function in Google Sheets?

google sheetsgoogle-sheets-arrayformula

I don't like expanding formulas. First, when I modify them, I have to copy them again, it is like copy&paste programming. Second, the I'd like them to match the original range, which might change. Ideally, I'd like to define a formula and range it operates on (e.g., sheet1!B4:B) and it applies accordingly. And when I add one more row to sheet1 (which increases the open-ended range sheet1!B4:B), it automatically adds a new computed row.

I've found something that can do some of those tricks: ArrayFormula. It can simply copy some data from one sheet to another, using the open-end range. It seems it can perform some trivial operations like addition. But I am not sure how to perform some more complex operations, that might operate with ranges on their own, like sum. For example, I'd like to compute sum for sheet1:B4:B and autoexpand it (without manual expanding) to all the following columns, so the cell right to the first cell would contain sum(sheet1!C4:C), cell right to this one would contain sum(sheet1!D4:D) and so on. This doesn't look like I can just use ArrayFormula for this, but I might be wrong.

(Of course, sum is just an example, I'd like to be able to write some other formulas.)

I appreciate any idea how to do this.

Best Answer

Alternatives:

  • Use ArrayFormula / MMULT functions
  • Make a custom function
    • Limitations:
      • Only works when using the Google Sheets desktop web app on online mode.
      • Requires some sort of programming knowledge and skills (JavaScript/Google Apps Script)
      • 30 seconds execution time limit
  • Make a macro/script
    • Limitations:
      • Similar to custom functions but longer execution time
      • Require to be triggered by a custom menu, dialog, sidebar, simple or installable triggers, from the Apps Script Editor or by using the Apps Script API
  • Make an add-on for Android
    • Limitations:
      • Requires some sort of programming knowledge and skills (Java/JavaScript/Android Studio/Google Apps Script)
      • It's on Developer Preview
      • Doesn't work for the Google Sheets desktop web app
      • Doesn't work for the Google Sheets iOS app