# Excluding Zero values from an Average Rollup

Topic Labels: Formulas
Solved
2926 2
cancel
Showing results for
Did you mean:
8 - Airtable Astronomer

Is it possible to exclude records that have a zero value from an average rollup?

1 Solution

Accepted Solutions
6 - Interface Innovator

There is no built-in aggregation function that does this. The easiest way I can think of to do this is simply create a formula column on the child table that filters out zeros, then do an AVERAGE() rollup on the formula field instead of directly on the numeric field. E.g.:

New “Nonzero” formula column on child table, with formula “IF(Value>0,Value)”
Rollup column on parent table, redefined as Rollup > Child Table > “Nonzero” > AVERAGE(values)

Should do what you want.

2 Replies 2
6 - Interface Innovator

There is no built-in aggregation function that does this. The easiest way I can think of to do this is simply create a formula column on the child table that filters out zeros, then do an AVERAGE() rollup on the formula field instead of directly on the numeric field. E.g.:

New “Nonzero” formula column on child table, with formula “IF(Value>0,Value)”
Rollup column on parent table, redefined as Rollup > Child Table > “Nonzero” > AVERAGE(values)

Should do what you want.

5 - Automation Enthusiast

Hi @drassi ,

thanks, this helped me to solve my issue. However, there is no example, so I didn't figure it out the first time.

My solution was to return BLANK() instead of a 0, when the Formula encountered a BLANK() at the first or second value. If this is done, the AVERAGE() function of the Rollup skips these values.

Example:
• Values is the first table:
• Data: The data are either blanks or numbers from 1 to infinite. They represent "bad" and "good" occurrences.
• Formula: IF(AND({👍}=BLANK(), {👎}=BLANK()), BLANK(), IF({👍}=BLANK(),-{👎},IF({👎}=BLANK(),{👍},{👍}/({👎}+{👍}))))
• Rollup in the other table: IF(COUNTA(values)!=0, AVERAGE(values), BLANK())

Hope it helps other people!

Best regards
Johannes