Thanks:  0
Likes:  0

1. Hello
I have a sheet for employee ages & salaries , I want for example (count of employees age between 20-25 years old & the sum salaries amount for this range )

2. On 2002-04-24 03:13, Target wrote:
Hello
I have a sheet for employee ages & salaries , I want for example (count of employees age between 20-25 years old & the sum salaries amount for this range )
Hello Target,
One of the formulas you can use is:
=SUMIF(A:A,">=20",B:B)-SUMIF(A:A,">25",B:B)
Where in column A you have ages and wages in column B.
Eli

3. Thank I got the sum of the range , the missing part is the count of the range (how many employee between 20-25 years?)

4. Try this :

="There are "&SUMPRODUCT((A1:A100<26)*(A1:A100>19))&" employees between 20 & 25 years with a total salary of £"&SUMIF(A:A,">=20",B:B)-SUMIF(A:A,">25",B:B)

For the sumproduct to work correctly you must have the size of the two arrays the same.

5. On 2002-04-24 04:04, Target wrote:
Thank I got the sum of the range , the missing part is the count of the range (how many employee between 20-25 years?)
Sorry,
For count:
=COUNTIF(A:A,">=20")-COUNTIF(A:A,">25")
Eli

6. Thank you folks I'm almost there , one small condition , how to get the highest salary amount among that range (20-25)?

7. Here tou go :

=INDIRECT("B"&MAX(ROW(A2:A25)*(A2:A25<=26)*(A2:A25>19)))

Again, you will need to ensure the array ranges are the same.

8. On 2002-04-24 04:31, Target wrote:
Thank you folks I'm almost there , one small condition , how to get the highest salary amount among that range (20-25)?
Array-enter:

=MAX(IF((A2:A100>=20)*(A2:A100),B2:B100))

In order to array-enter a formula, you need to hit control+shift+enter at the same time, not just enter.

Note. You can't use whole columns in array formulas, something that you can do in SUMIF and COUNTIF formulas (see Eli's replies). I'd suggest using in all these formulas definite ranges (or better dynamic name ranges).

9. Let's not overlook the use of a PivotTable which is well suited for this type of request. Given the following data...

******>
 Employee Age Salary Larry 19 50000 Jane 20 80000 Tom 25 65000 Joe 26 90000

…you’d get…

******>
 Data Age Count of Employee Sum of Salary Max of Salary 20-25 2 145000 80000

User Tag List

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•