# Solved

**URL:** <https://community.glideapps.com/t/solved/15299>\
**Category:** Ask for Help\
**Created:** [September 5, 2020, 1:58am UTC](https://community.glideapps.com/t/solved/15299 "2020-09-05T01:58:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_eric](https://avatars.discourse-cdn.com/v4/letter/_/5f9b8f/32.png) [@\_eric](https://community.glideapps.com/u/_eric)\
**Post date:** [September 5, 2020, 1:58am UTC](https://community.glideapps.com/t/solved/15299/1 "2020-09-05T01:58:52Z")

</div>

I am trying to have a google sheet formula that functions whenever a new row is created. However, when I add the formula it creates “0” values even when there are no rows. Basically adding 1000 rogue rows.

This is the formula I am trying to continue down column J - =ARRAYFORMULA(HOUR(D2+E2))

How can I have my column formula work for each added row?

---

<div class="post-metadata">

**Author:** ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)\
**Post date:** [September 5, 2020, 2:05am UTC](https://community.glideapps.com/t/solved/15299/2 "2020-09-05T02:05:18Z")

</div>

Check out this post: [Tutorial: Arrayformula in Google Sheets, good practices & how to overcome Arrayformula restrictions with scripts](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727)

Basically, you have to create an IF formula to check if there’s a value in a specific column (usually the 1st one) in order to conditionally perform the calculation, or leave the cell blank.

---

<div class="post-metadata">

**Author:** ![Pratik\_Shah](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pratik_shah/32/12416_2.png) [@Pratik\_Shah](https://community.glideapps.com/u/Pratik_Shah)\
**Post date:** [September 5, 2020, 5:53am UTC](https://community.glideapps.com/t/solved/15299/3 "2020-09-05T05:53:46Z")

</div>

> [@\_eric](#):
>
> =ARRAYFORMULA(HOUR(D2+E2)

You can use this formula.  
=IF(ISBLANK(D2),“”,ARRAYFORMULA(HOUR(D2+E2)))

This can be modified in many ways and as per requirement.

---

<div class="post-metadata">

**Author:** ![\_eric](https://avatars.discourse-cdn.com/v4/letter/_/5f9b8f/32.png) [@\_eric](https://community.glideapps.com/u/_eric)\
**Post date:** [September 5, 2020, 5:19pm UTC](https://community.glideapps.com/t/solved/15299/4 "2020-09-05T17:19:05Z")

</div>

Thank you @Pratik_Shah. the document is still populating the zeros.

Where do I place the formula… in the header? or in the second row?

Basically I want the formula to work for all new added rows. But when I post it, it creates “0” down the spreadsheet therefore creating thousands of rows before they were actually created.

---

<div class="post-metadata">

**Author:** ![Pratik\_Shah](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pratik_shah/32/12416_2.png) [@Pratik\_Shah](https://community.glideapps.com/u/Pratik_Shah)\
**Post date:** [September 5, 2020, 6:02pm UTC](https://community.glideapps.com/t/solved/15299/5 "2020-09-05T18:02:16Z")

</div>

Can you share your sheet? or a sample sheet with your details?

---

<div class="post-metadata">

**Author:** ![darder](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darder/32/12788_2.png) [@darder](https://community.glideapps.com/u/darder)\
**Post date:** [September 5, 2020, 7:34pm UTC](https://community.glideapps.com/t/solved/15299/6 "2020-09-05T19:34:23Z")

</div>

Look at this.

> [@I need help formatting a date as month](https://community.glideapps.com/t/i-need-help-formatting-a-date-as-month/15178):
>
> Hi everybody I need some help about how to format a date MM/DD/YYYY HH:MM in a new calculated (Template??) column which show the MMMM for every single row. I put an example of what I mean using the google sheet but I need to get this conversion on Glide to obtain the result in new rows. [image] Thanks

Arrays with this particular syntax must go on first row as the formula defines the name of the row.

---

<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 5, 2020, 11:29pm UTC](https://community.glideapps.com/t/solved/15299/7 "2020-09-05T23:29:08Z")

</div>

If it’s returning zero all the way down, be sure the ISBLANK part of the formula is truly looking at a column that should be empty or not. Also the IF statement should be within the Arrayformula. Not outside of it. And change ‘D2’ to ‘D2:D’ because you want to look at a range of cells. Not just cell D2.

Arrayformulas should use a range of cells, so also change ‘D2+E2’ to ‘D2:D+E2:E’

If you are putting the formula in the second row, then us this:  
`=ARRAYFORMULA(IF(ISBLANK(D2:D),"",HOUR(D2:D+E2:E)))`

If putting in row 1 along with the heading, then use this:  
`={"Heading";ARRAYFORMULA(IF(ISBLANK(D2:D),"",HOUR(D2:D+E2:E)))}`

If you still have issues, overwrite any double quotes. Sometimes they copy weird from the forum. Also, depending on the regional locale of the sheet, some countries swap commas and semicolons.

---

<div class="post-metadata">

**Author:** ![\_eric](https://avatars.discourse-cdn.com/v4/letter/_/5f9b8f/32.png) [@\_eric](https://community.glideapps.com/u/_eric)\
**Post date:** [September 6, 2020, 1:19am UTC](https://community.glideapps.com/t/solved/15299/8 "2020-09-06T01:19:05Z")

</div>

Thanks for your help everyone. I got it figured out.

> [@Jeff\_Hager](#):
>
> ={“Heading”;ARRAYFORMULA(IF(ISBLANK(D2:D),“”,HOUR(D2:D+E2:E)))}
