Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 3
Unhappy Average with out zeros or blanks

I'm trying to average a set of cells that are not continuous and would like to get an average as long as the cell is not zero or empty. Here are the cells I'm looking to average. Currently I'm using an average option but it will not give me an average unless all five cells are filled

=AVERAGE(E137,E163,E189,E215,E241)

I heard there is a countif and sum option or something like that but I get too many arguments when trying to use it.
  #2   Report Post  
Senior Member
 
Location: Hyderabad
Posts: 237
Thumbs up

Quote:
Originally Posted by Permdawg View Post
I'm trying to average a set of cells that are not continuous and would like to get an average as long as the cell is not zero or empty. Here are the cells I'm looking to average. Currently I'm using an average option but it will not give me an average unless all five cells are filled

=AVERAGE(E137,E163,E189,E215,E241)

I heard there is a countif and sum option or something like that but I get too many arguments when trying to use it.

i wrote user-defined function for you. Syntax is below

=my_average("Column Name",Starting range, ending range)
example: =my_average("A",1,65536)
measures the average in column A from the cell first to end

copy the below vba code into module

'created by Bala Sesharao

Function my_average(columnd As String, start_range As Variant, end_range As Variant)
Dim a, i, k, count_of_occurence As Variant
k = 0
count_of_occurence = 0
For i = start_range To end_range
a = ActiveWorkbook.Sheets("sheet1").Range(columnd & i)
If a < "" Then
k = k + a
count_of_occurence = count_of_occurence + 1
End If
Next i
my_average = k / count_of_occurence
End Function

all the best
__________________
Thanks
Bala
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Average Multiple Worksheets without blanks or zeros Shawn S. Excel Discussion (Misc queries) 2 December 14th 09 12:21 PM
Counting blanks as zeros bob Excel Worksheet Functions 1 November 26th 09 06:04 PM
Average not including Zeros/Blanks DaS Excel Worksheet Functions 8 October 17th 07 06:29 PM
Vlookup blanks = zeros Marilyn Excel Discussion (Misc queries) 6 March 18th 07 01:21 AM
Blanks chart as zeros CLR Charts and Charting in Excel 10 April 11th 05 01:38 AM


All times are GMT +1. The time now is 07:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"