Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Calculating Averages based on criteria

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 #?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default Calculating Averages based on criteria

Hi,
try

=AVERAGEIF(E6:E9,"Y",D6:D9)

change the range to fit your needs

if this helps please click yes, thanks

"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 #?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Calculating Averages based on criteria

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 #?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Calculating Averages based on criteria

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 #?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Calculating Averages based on criteria

never mind I see you didn't use averageif.

Is there away to have the formula average 2, 3 or 4 cells depending on the
number of years the user selects? It would always start from the last three
years so D,C,B.


A B C D E F G
10 12 8 15 Y 3 11.6 Avg of 3 years

"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 #?



  #6   Report Post  
Posted to microsoft.public.excel.misc
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 #?


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Calculating Averages based on criteria

With your sample data in row1 try the below formula in cell G1

=IF(E1="Y",AVERAGE(INDIRECT(ADDRESS(ROW(A1),COLUMN (D1)-F1+1) &":D1")),"")

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


"Kgov" wrote:

never mind I see you didn't use averageif.

Is there away to have the formula average 2, 3 or 4 cells depending on the
number of years the user selects? It would always start from the last three
years so D,C,B.


A B C D E F G
10 12 8 15 Y 3 11.6 Avg of 3 years

"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 #?

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
Calculating a Percent based on Tiered criteria A Morrison Excel Discussion (Misc queries) 1 January 7th 09 05:18 PM
Calculating the mode of a criteria-based range PaladinWhite Excel Discussion (Misc queries) 20 August 9th 08 02:50 AM
Calculating Mode for multiple arrays based on criteria in another AngelaMaria Excel Worksheet Functions 3 November 3rd 06 01:57 AM
Calculating an average based on 2 and 3 criteria craggergirl Excel Worksheet Functions 2 February 24th 06 02:37 PM
calculating averages keving Excel Worksheet Functions 8 December 9th 04 01:23 AM


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

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"