# Tutorial: Arrayformula in Google Sheets, good practices & how to overcome Arrayformula restrictions with scripts

**URL:** https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727
**Category:** Ask for Help
**Created:** [May 25, 2020, 1:10pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727 "2020-05-25T13:10:24Z")
**Posts on this page:** 20
**Page:** 6

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [April 5, 2021, 5:51pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/102 "2021-04-05T17:51:31Z")

</div>

This concept app does exactly that (and more)…

> [@The Magic Inline List that thinks it's a Choice Component scream](https://community.glideapps.com/t/the-magic-inline-list-that-thinks-its-a-choice-component/24834/11):
>
> @Wiz.Wazeer, Here you go. I hope it is what you were expecting. rofl Edit: if you get to improve it. Please, share it with us.

---

<div class="post-metadata">

### Author: ![Falcor](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/falcor/32/3166_2.png) [@Falcor](https://community.glideapps.com/u/Falcor)
#### Post date: [April 5, 2021, 8:39pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/103 "2021-04-05T20:39:01Z")

</div>

Sorry, did not understand how to use arrayformula to count the exact number of True in several columns. I wrote the numbers I expect in red square.  
 ![img-2021-04-05-23-33-26](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/3/c30c746ca48991e4050ee8785268f925c58e128a.png)

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [April 5, 2021, 11:18pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/104 "2021-04-05T23:18:06Z")

</div>

What layout do you expect? Do you want a checklist or do you want something like what Darren did in the link he provided?

Either way, the idea is to use a relation and have a joined list column linking all the items chosen together, then write them to the Sheet using a set column action.

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [April 5, 2021, 11:23pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/105 "2021-04-05T23:23:05Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/a/4a61d1e4e96e52fc9fc4e0743d2a62950a8347f1.png)

Here’s the formula to do so.

> **[Thinh Dinh's lab V2.0](https://docs.google.com/spreadsheets/d/1JzBrp4R1zK9CMfmTzWWcPPep9-ZCl3OXxgWu27NWCy8/edit#gid=113189588)**
>
> Video Image
> 
> Video title,Video link,Image link
> Test,\<a href="http://res.cloudinary.com/thinhdinh/video/upload/v1608871912/lh074eeiyvblorxua7sa.mp4"\>http://res.cloudinary.com/thinhdinh/video/upload/v1608871912/lh074eeiyvblorxua7sa.mp4\</a\>,\<a...

---

<div class="post-metadata">

### Author: ![bradsigep](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/bradsigep/32/22893_2.png) [@bradsigep](https://community.glideapps.com/u/bradsigep)
#### Post date: [April 6, 2021, 5:49pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/106 "2021-04-06T17:49:44Z")

</div>

Ok I will try that strategy then. What I was expecting is for the User to fill out a form and can select multiple options at once from a list.  
i.e. Food Cuisines App  
Options: “French, Chinese, American, Peruvian”  
User Selects : “French, Peruvian” as their 2 options

Then question is followed by Favorite Areas To Eat  
Options: “Houston, Scottsdale, Salem”  
User Selects: “Houston, Scottsdale” as their options

Then Google Sheet holds  
User’s Name  
Users Food Cuisine  
Users Favorite Places to Eat.

Not sure how to do it so that the User isn’t selecting from separate dropdowns each time in order to create a list ☹

Best,

---

<div class="post-metadata">

### Author: ![SantiagoPerez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santiagoperez/32/16807_2.png) [@SantiagoPerez](https://community.glideapps.com/u/SantiagoPerez)
#### Post date: [April 6, 2021, 7:35pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/107 "2021-04-06T19:35:02Z")

</div>

Holal @bradsigep,

This post mught give you an idea of how to do it. [Reset Multiple Rows At Once](https://community.glideapps.com/t/reset-multiple-rows-at-once/22211)

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [April 6, 2021, 11:16pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/108 "2021-04-06T23:16:10Z")

</div>

Do you really need that info in the Sheet? Not saying that it can’t be done, but it would be easy if you don’t require that. You can store those boolean values in user-specific columns and give users a checklist layout.

---

<div class="post-metadata">

### Author: ![Jaime](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jaime/32/72726_2.png) [@Jaime](https://community.glideapps.com/u/Jaime)
#### Post date: [April 16, 2021, 12:36am UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/109 "2021-04-16T00:36:35Z")

</div>

Thanks for this tutorial @ThinhDinh, I just used it on a project and it worked flawlessly 👍 👍

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [April 16, 2021, 3:05am UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/110 "2021-04-16T03:05:12Z")

</div>

Glad it could have helped!

---

<div class="post-metadata">

### Author: ![Cold\_Avenue](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/cold_avenue/32/21318_2.png) [@Cold\_Avenue](https://community.glideapps.com/u/Cold_Avenue)
#### Post date: [May 31, 2021, 8:42pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/111 "2021-05-31T20:42:55Z")

</div>

Do I need a glide account to make it run?  
Where do I need to paste the =fillFormula() function?

I renamed the script to my sheetsname, adjusted the range to my specific range, but it didn’t work. I would apreciate it a lot, if some could make a youtube video on how to use this script to make a stocks tickers symbol list dynamic to e.g. the stocks last price when new tickers are added.

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [May 31, 2021, 11:05pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/112 "2021-05-31T23:05:28Z")

</div>

No, you don’t need a Glide account to make those scripts run.

Here’s a walkthrough from Ben Collins: [https://www.benlcollins.com/apps-script/google-apps-script-beginner-guide/](https://www.benlcollins.com/apps-script/google-apps-script-beginner-guide/)

If you still need me to help with this, please share your Sheet to [ariesarsenal@gmail.com](mailto:ariesarsenal@gmail.com).

---

<div class="post-metadata">

### Author: ![profxeni](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/profxeni/32/24656_2.png) [@profxeni](https://community.glideapps.com/u/profxeni)
#### Post date: [June 13, 2022, 1:17pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/113 "2022-06-13T13:17:24Z")

</div>

Hi @ThinhDinh ,  
I just now discovered your tutorial which was what I needed. As usual well done, with lots of examples, but is something missing in my Google Sheet? For example I can’t find in edit the whole section about triggers. Also, it gives me this error: The matrix result was not expanded because it would have overwritten the data in D1?? ☹

I am trying to split a geolocation (ex: 45.995211,12.86631) into two columns (lat/lon), using the SPLIT formula and adding the ARRAYFORMULA:  
={“Lat”,ARRAYFORMULA(INDEX(SPLIT(A2:A,","),1))}  
={“Lon”,ARRAYFORMULA(INDEX(SPLIT(A2:A,","),2))}

Where am I wrong? Thanks as always

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [June 13, 2022, 1:39pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/114 "2022-06-13T13:39:02Z")

</div>

> [@profxeni](#):
>
> The matrix result was not expanded because it would have overwritten the data in D1??

In there anything in cell D1?  
Arrayformulas will not expand if it means over writing existing data.

> [@profxeni](#):
>
> I am trying to split a geolocation (ex: 45.995211,12.86631) into two columns (lat/lon), using the SPLIT formula and adding the ARRAYFORMULA:  
> ={“Lat”,ARRAYFORMULA(INDEX(SPLIT(A2:A,“,”),1))}  
> ={“Lon”,ARRAYFORMULA(INDEX(SPLIT(A2:A,“,”),2))}

Do you actually need this in the Google Sheet?  
If not, you’ll find it much easier with a simple Split Text column in your Glide Table. You could then use a couple of Single Value columns to address each of the Lat/Long values.

---

<div class="post-metadata">

### Author: ![profxeni](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/profxeni/32/24656_2.png) [@profxeni](https://community.glideapps.com/u/profxeni)
#### Post date: [June 13, 2022, 1:45pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/115 "2022-06-13T13:45:19Z")

</div>

YES I need it because in the same sheet I use Google Maps functions and if I do it inside glide with calculated columns, they would not show up in Google Sheet.

Yes in D1 I have a column, as well as in the adjacent ones. Using ARRAYFORMULA should I leave the columns to the right free?

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [June 13, 2022, 11:15pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/116 "2022-06-13T23:15:43Z")

</div>

It looks like the comma after “Lat” and “Lon” should be a semicolon instead.

I’m not sure if INDEX works with arrayformula, if it doesn’t work the right way please tell me.

---

<div class="post-metadata">

### Author: ![IDEApps](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ideapps/32/42628_2.png) [@IDEApps](https://community.glideapps.com/u/IDEApps)
#### Post date: [September 8, 2022, 2:49pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/117 "2022-09-08T14:49:18Z")

</div>

Hi @ThinhDinh…

I use arrayformula as follows: **=ARRAYFORMULA(IF(ISBLANK(AE2:AE),“”,AE2:AE+AR2:AR+BE2:BE))** on cell BK2. Then, I format BK column with the number formula: Rp1,000 as image below. But, when I insert/input a new row, the number format doesn’t work to a new number (cell BK5). And, I have to reformat the numbers manually 🙃

Do you know how to solve this problem?

Thanks in advance

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/1/d18ee052346f8096baeca0e5fe9f6203841ce358.png)

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [September 8, 2022, 3:49pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/118 "2022-09-08T15:49:55Z")

</div>

Is there any particular reason you are not use a math column in glide to calculate that result, and then formatting it within glide?

---

<div class="post-metadata">

### Author: ![IDEApps](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ideapps/32/42628_2.png) [@IDEApps](https://community.glideapps.com/u/IDEApps)
#### Post date: [September 8, 2022, 11:55pm UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/119 "2022-09-08T23:55:34Z")

</div>

Because the numbers are related to its Google app script. I can’t use a math column for GAS. Do you have any suggestion @Jeff_Hager?

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [September 9, 2022, 12:07am UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/120 "2022-09-09T00:07:55Z")

</div>

Do you need it to be a number? If you can live with it being a text, I think you can just add “Rp” to the formula before you calculate it.

```auto
=ARRAYFORMULA(IF(ISBLANK(AE2:AE),“”,"Rp"&AE2:AE+AR2:AR+BE2:BE)) 

```

---

<div class="post-metadata">

### Author: ![IDEApps](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ideapps/32/42628_2.png) [@IDEApps](https://community.glideapps.com/u/IDEApps)
#### Post date: [September 9, 2022, 12:20am UTC](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727/121 "2022-09-09T00:20:04Z")

</div>

Yes, I need it to be a number. Is it possible?

[Previous page](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727.md?page=5)

[Next page](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727.md?page=7)
