View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson Ken Johnson is offline
external usenet poster
 
Posts: 1,073
Default 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