ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Calculating averages for subgroups (https://www.excelbanter.com/excel-discussion-misc-queries/167062-calculating-averages-subgroups.html)

PSmith

Calculating averages for subgroups
 
I have a worksheet that shows the sex of the student (M or F) and their test
scores.
How do I calculate the average for each subgroup rather than for the group
as a whole? I've converted the original "sex" data to numeric, but am still
stuck.

Col. A Col. B Col. C
M 1 65.2
M 1 77.5
F 2 83.4
F 2 59.7
M 1 59.6

pinmaster

Calculating averages for subgroups
 
Hi,

Try these array formulas:

=AVERAGE(IF((A1:A10="M"),D1:D10))

or

=AVERAGE(IF((B1:B10=1),D1:D10))

enter using Ctrl+Shift+Enter

HTH
Jean-Guy


M 1 65.2
M 1 77.5
F 2 83.4
F 2 59.7
M 1 59.6


M 1 65.2
M 1 77.5
F 2 83.4
F 2 59.7
M 1 59.6


M 1 65.2
M 1 77.5
F 2 83.4
F 2 59.7
M 1 59.6


M 1 65.2
M 1 77.5
F 2 83.4
F 2 59.7
M 1 59.6


"PSmith" wrote:

I have a worksheet that shows the sex of the student (M or F) and their test
scores.
How do I calculate the average for each subgroup rather than for the group
as a whole? I've converted the original "sex" data to numeric, but am still
stuck.

Col. A Col. B Col. C
M 1 65.2
M 1 77.5
F 2 83.4
F 2 59.7
M 1 59.6



All times are GMT +1. The time now is 12:39 AM.

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