View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Fred Smith[_4_] Fred Smith[_4_] is offline
external usenet poster
 
Posts: 2,389
Default Calculating Averages based on criteria

Average is just Sum divided by count, so use:

=sumif(a1:a5,"Y",b1:b5)/countif(a1:a5,"Y",b1:b5)

Regards,
Fred.

"Kgov" wrote in message
...
I should have mentioned. I don't have averageif. (not sure what
version...new job)

"Jacob Skaria" wrote:

If you mean your data as below; then try the below formula. Please note
that
this is an array formula. Within the cell in edit mode (F2) paste this
formula and press Ctrl+Shift+Enter to apply this formula. If successful
in
'Formula Bar' you can notice the curly braces at both ends like
"{=<formula}"

Col A Col B Col C
Y 3 =AVERAGE(IF(A1:A5="Y",B1:B5))
N 3
Y 6
N 5


If this post helps click Yes
---------------
Jacob Skaria


"Kgov" wrote:

I'm trying to calculate an average based on some criteria in the
adjacent
columns. The user has to first identiy Y or N and then determine if the
average should be calculated based on 2, 3 or 4 years.

Is there a formula that would only averge the correct number of cells
2, 3
or 4 years depending on what the user picked and divide by the right #?