# Dataeditor: average calculation on non empty cells?

**URL:** https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913
**Category:** Ask for Help
**Created:** [August 12, 2020, 11:05pm UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913 "2020-08-12T23:05:05Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![AyS\_0908](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ays_0908/32/27349_2.png) [@AyS\_0908](https://community.glideapps.com/u/AyS_0908)
#### Post date: [August 12, 2020, 11:05pm UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913/1 "2020-08-12T23:05:05Z")

</div>

Hi, I calculate “Averages” on user’s Form data; these data won’t sync in G-Sheet, so I use the dataeditor with a Maths formula: (col A + col B + col C) / 3.

Nevertheless, in the Form, the user may not fill-in all columns (for UX matters, I don’t want to make them “required”); when some cells in columns are empty, I therefore may have false “Averages” given that I always divide by “3”.

> While easy in G-Sheet, how to manage the dataeditor to get: “If 1/3 column is empty, divide by 2 | if 2/3 columns are empty divide by 1”?

Many thanks in advance

---

<div class="post-metadata">

### Author: ![S\_C](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/s_c/32/12766_2.png) [@S\_C](https://community.glideapps.com/u/S_C)
#### Post date: [August 12, 2020, 11:19pm UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913/2 "2020-08-12T23:19:06Z")

</div>

I’d see if there is a way to calculate the total number of empty columns matching the criteria and subtract from denominator? Not sure if possible in glide.

---

<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: [August 12, 2020, 11:26pm UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913/3 "2020-08-12T23:26:37Z")

</div>

It would probably take a few glide columns, but create if then columns to check for non empty cells and return ‘1’, then add them up in a math column, then use that value for your final average math formula.

---

<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: [August 13, 2020, 12:12am UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913/4 "2020-08-13T00:12:33Z")

</div>

How many digits does each of your column have? Was just a wild idea by me but let’s say if you always have 1 digit for your columns, you can create a template column joining your 3 columns without space.

So 1 1 2 becomes 112, blank 1 3 becomes 13 etc.

Then an If Then Else column, if Template column \> 100 then 3, \> 10 then 2, \> 0 then 1.

---

<div class="post-metadata">

### Author: ![AyS\_0908](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ays_0908/32/27349_2.png) [@AyS\_0908](https://community.glideapps.com/u/AyS_0908)
#### Post date: [August 13, 2020, 7:32am UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913/5 "2020-08-13T07:32:17Z")

</div>

Thanks @Jeff_Hager @ThinhDinh @S_C I book my next holidays to test both methods: I have 10 different “Averages” calculation to do, this will be dozens of columns… !  
Thanks again

---

<div class="post-metadata">

### Author: ![AyS\_0908](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ays_0908/32/27349_2.png) [@AyS\_0908](https://community.glideapps.com/u/AyS_0908)
#### Post date: [August 13, 2020, 8:49am UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913/6 "2020-08-13T08:49:46Z")

</div>

@ThinhDinh, I am testing your method but I have a very basic question… : If Then Else doesn’t work for me with \> 10 (see the “44” and “43” at the bottom of the picture).  
What did I do wrong?  
Thanks

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/f/f2a59f86083a217c8e0bd77b8479c6bde3608a04.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: [August 13, 2020, 9:01am UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913/7 "2020-08-13T09:01:54Z")

</div>

Ah I realized where the problem is. Add a math column taking the template value, then use the If Then Else with it. The original template column doesn’t give you the option to compare numbers.

---

<div class="post-metadata">

### Author: ![AyS\_0908](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ays_0908/32/27349_2.png) [@AyS\_0908](https://community.glideapps.com/u/AyS_0908)
#### Post date: [August 13, 2020, 9:27am UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913/8 "2020-08-13T09:27:16Z")

</div>

Hum … I get the same results with the ‘math’ column instead of the ‘template’ one; it does not calculate the “\> 10”. I thought it would display options such as “greater than” etc, but nothing…  
Finally, I can solve my issues with only 2 “if then else” per division as @Jeff_Hager proposed  
. ifA col1 not empty: 1  
. ifB col2 not empty: 1  
. maths: (col1+col2) / (ifA + ifB)

Thanks !

---

<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: [August 13, 2020, 12:19pm UTC](https://community.glideapps.com/t/dataeditor-average-calculation-on-non-empty-cells/13913/9 "2020-08-13T12:19:11Z")

</div>

FYI. You can’t add a comparison operator, like the greater than or less than symbol, as part of the value being compared. “Is” is the same as “equal” so you were trying to compare if value 1 is equal to the text string “\>10”. Something like that is never going to work, however if a column is recognized as numeric, then you should be presented with comparisons, such as greater than or less than to choose from.
