ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Calculating Average Length of Service (https://www.excelbanter.com/excel-worksheet-functions/201364-calculating-average-length-service.html)

EasyPeasy

Calculating Average Length of Service
 
I've got a spreadsheet that includes 3 columns with range names of 'gender'
(containing either M or F), 'age' and 'company_service' (both expressed as
years).

I want to be able to calculate the average length of service for men and
women separately based on age bands (eg between 21 and 30).

Can someone please start me off with a formula that can handle one set of
conditions from which I can hopefully work out the rest. eg :

Lower Age Band 21
Upper Age Band 30
Gender M

Thanks






ExcelBanter AI

Answer: Calculating Average Length of Service
 
To calculate the average length of service for men between the ages of 21 and 30 in Excel:
  1. Select a cell where you want to display the result.
  2. Type the following formula into the cell:
    Formula:

    =AVERAGEIFS(company_servicegender"M"age"="&21age"<="&30

  3. Press Enter to calculate the result.

This formula uses the AVERAGEIFS function to calculate the average of the values in the 'company_service' column that meet the following criteria:

- 'gender' is equal to "M"
- 'age' is greater than or equal to 21
- 'age' is less than or equal to 30

This formula should give you the average length of service for men between the ages of 21 and 30. To calculate the average length of service for women in the same age range, you can use a similar formula but change the "M" to "F" in the formula.

You can also adjust the age range and gender criteria in the formula to calculate averages for different groups. Just make sure to separate each criterion with a comma and enclose text criteria in quotation marks.

Gary''s Student

Calculating Average Length of Service
 
Divide the total years of service of the selected subgroup by the number of
individuals in the subgroup:

=SUMPRODUCT(--(A1:A100="M"),--(B1:B10020),--(B1:B100<31),C1:C100)/SUMPRODUCT(--(A1:A100="M"),--(B1:B10020),--(B1:B100<31))

for for data like:

F 38 3
F 32 4
F 38 7
F 31 5
F 27 6
F 32 3
M 40 5
M 38 3
M 30 1
M 20 5
F 23 6
F 26 2
M 27 6
F 30 4
M 27 4
M 37 4
F 20 7
F 23 2
F 38 1
M 22 6
M 30 4
F 20 4
M 29 1
F 33 5
M 30 3
F 29 4
F 23 4
F 39 7
M 34 6
F 25 1

for fomula returns 3.571428571

--
Gary''s Student - gsnu2007k


"EasyPeasy" wrote:

I've got a spreadsheet that includes 3 columns with range names of 'gender'
(containing either M or F), 'age' and 'company_service' (both expressed as
years).

I want to be able to calculate the average length of service for men and
women separately based on age bands (eg between 21 and 30).

Can someone please start me off with a formula that can handle one set of
conditions from which I can hopefully work out the rest. eg :

Lower Age Band 21
Upper Age Band 30
Gender M

Thanks







Teethless mama

Calculating Average Length of Service
 
XL-2007:
=AVERAGEIFS(C1:C100,A1:A100,"M",B1:B100,"20",B1:B 100,"<31")
just press ENTER


Earlier versions:

=AVERAGE(IF((A1:A100="M")*(B1:B10020)*(B1:B100<31 ),C1:C100))
ctrl+shift+enter, not just ENTER


"EasyPeasy" wrote:

I've got a spreadsheet that includes 3 columns with range names of 'gender'
(containing either M or F), 'age' and 'company_service' (both expressed as
years).

I want to be able to calculate the average length of service for men and
women separately based on age bands (eg between 21 and 30).

Can someone please start me off with a formula that can handle one set of
conditions from which I can hopefully work out the rest. eg :

Lower Age Band 21
Upper Age Band 30
Gender M

Thanks








All times are GMT +1. The time now is 05:25 PM.

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