ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Taking Average ignoring #DIV/0! in the range... (https://www.excelbanter.com/excel-worksheet-functions/227845-taking-average-ignoring-div-0-range.html)

Astro

Taking Average ignoring #DIV/0! in the range...
 
Currently if I use the average function for the months, it will show the
results to be "#DIV/0!".

What formula can I use such that when theres only data for 4 months, it will
only take average of 4 months and if theres 5 months data it will only take
average of 5 months and so on instead of showing me "#DIV/0!".

Please help. Thanks!

A B
1 January 100.00%
2 February 100.00%
3 March 100.00%
4 April 13.33%
5 May #DIV/0!
6 June #DIV/0!
7 July #DIV/0!
8 August #DIV/0!
9 September #DIV/0!
10 October #DIV/0!
11 November #DIV/0!
12 December #DIV/0!
13
14 Avg. (%) #DIV/0!


T. Valko

Taking Average ignoring #DIV/0! in the range...
 
The easiest way to handle this would be to change the formulas so they don't
return errors. For example:

=IF(ISERROR(your_formula),"",your_formula)

These will ignore the errors:

=IF(COUNT(B1:B12),SUMIF(B1:B12,"<1E100")/COUNT(B1:B12),"")

This one is an array formula** :

=IF(COUNT(B1:B12),AVERAGE(IF(ISNUMBER(B1:B12),B1:B 12)),"")

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Astro" wrote in message
...
Currently if I use the average function for the months, it will show the
results to be "#DIV/0!".

What formula can I use such that when theres only data for 4 months, it
will
only take average of 4 months and if theres 5 months data it will only
take
average of 5 months and so on instead of showing me "#DIV/0!".

Please help. Thanks!

A B
1 January 100.00%
2 February 100.00%
3 March 100.00%
4 April 13.33%
5 May #DIV/0!
6 June #DIV/0!
7 July #DIV/0!
8 August #DIV/0!
9 September #DIV/0!
10 October #DIV/0!
11 November #DIV/0!
12 December #DIV/0!
13
14 Avg. (%) #DIV/0!





All times are GMT +1. The time now is 06:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com