ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formula help needed for averages (https://www.excelbanter.com/excel-programming/380922-re-formula-help-needed-averages.html)

Bernard Liengme

formula help needed for averages
 
Use =AVERAGE(IF(C21:C45<0,C21:C45))
this is an array formula so complete it with CTRL+SHIFT+ENTER not a simple
ENTER; Excel will place the formula within curly braces {}
OR non-array formula =SUM(C21:C45)/COUNTIF(C21:C45,"<0")

best wishes

--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"phil-rge-ee" wrote in message
...
I have a cells C21 thru C45 that have numbers in them. I need to add them
all
together and then divide by the number of cells that have a number greater
than 0 in them. This would be used to get an average number. If the cell
is 0
then I don't want to include it in the dividing process. Example:
C21 is 5
C22 is 3
C23 is 0
C24 is 7
C25 is 0

I would need the formula or VB script to add the numbers then divide by 3
(not divide by 5 - eliminating the cells with 0 in them) So the answer in
the
example here would be 5, not 3. (15 divided by 3).
Thanks for any help.

Phil





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

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