ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   averageif for a range of values in another column (https://www.excelbanter.com/excel-discussion-misc-queries/228931-averageif-range-values-another-column.html)

-ken

averageif for a range of values in another column
 
I need to take the average of colum A for the cells that have either a 1 or a
2 in the corresponding rows of column B. How do I do this?

Ken Johnson

averageif for a range of values in another column
 
On Apr 26, 9:21*am, -ken wrote:
I need to take the average of colum A for the cells that have either a 1 or a
2 in the corresponding rows of column B. How do I do this?


One way, for first 100 rows...

=SUMPRODUCT(A1:A100,--((B1:B100=2)+(B1:B100=1)))/SUMPRODUCT(--
((B1:B100=2)+(B1:B100=1)))

Ken Johnson

T. Valko

averageif for a range of values in another column
 
Try this array formula** :

=AVERAGE(IF(B1:B20={1,2},A1:A20))

** 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


"-ken" wrote in message
...
I need to take the average of colum A for the cells that have either a 1 or
a
2 in the corresponding rows of column B. How do I do this?





All times are GMT +1. The time now is 02:33 PM.

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