[Solved] Average not showing 0 answer

Discuss the spreadsheet application
Post Reply
totalsum
Posts: 5
Joined: Sun Dec 03, 2017 6:41 pm

[Solved] Average not showing 0 answer

Post by totalsum »

Hi all,

what is wrong with this:
=IF(((AVERAGE(C7:C18))=0;"";(AVERAGE(C7:C18)))

when C7:C18 have no values yet i get #div/0!
but i ask for "" ,like show nothing.

anyone know a better way to get a blank cell when the outcome of average is 0?
Last edited by Hagar Delest on Sun Dec 10, 2017 11:24 pm, edited 1 time in total.
Reason: tagged [Solved].
LibreOffice 5.3.4.2 on Windows10
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: average not showing 0 answer

Post by RusselB »

An average is the summation of numbers entered, then divided by the quantity of numbers entered.
Since you have no entries, there is nothing for the summation or the division, thus the average function is trying to do division by zero (which is what that error is)
If you want the formula to return a blank when there are no entries, you could use

Code: Select all

=if(or(iserr(average(c7:c18));average(c7:c18)=0);"";average(c7:c18))
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
eremmel
Posts: 1080
Joined: Tue Dec 30, 2008 1:15 am

Re: average not showing 0 answer

Post by eremmel »

Or take advantage of the fact that when avg == 0, then sum==0 , and empty cells count as 0 for sum() as well:

Code: Select all

=IF(SUM(C7:C18)=0;"";AVERAGE(C7:C18))
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: average not showing 0 answer

Post by Lupp »

Code: Select all

=IF(COUNT(C7:C18)=0;"No values!";AVERAGE(C7:C18))
This is the reasonabl solution, imo. Since an average of 0 (zero) is a valid result, it should actually be reported.
If there are specific reasons to suppress the result if it's 0, the following formula would do:

Code: Select all

=IF(COUNT(C7:C18)=0;"No values!";IF(SUM(C7:C18)=0;"";AVERAGE(C7:C18)))
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
totalsum
Posts: 5
Joined: Sun Dec 03, 2017 6:41 pm

Re: Average not showing 0 answer

Post by totalsum »

Thanks for the quick replies you all!
And the solutions all work fine for me.

like this i'll be an expert in no time!?!!
Thanks
LibreOffice 5.3.4.2 on Windows10
Post Reply