Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 9 of 9

Thread: count & range

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    31
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    Board Regular eliW's Avatar
    Join Date
    Mar 2002
    Posts
    1,919
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #3
    New Member
    Join Date
    Apr 2002
    Posts
    31
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #4
    Board Regular
    Join Date
    Apr 2002
    Location
    Midlands, UK
    Posts
    217
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #5
    Board Regular eliW's Avatar
    Join Date
    Mar 2002
    Posts
    1,919
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #6
    New Member
    Join Date
    Apr 2002
    Posts
    31
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

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

  7. #7
    Board Regular
    Join Date
    Apr 2002
    Location
    Midlands, UK
    Posts
    217
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #8
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    83,647
    Post Thanks / Like
    Mentioned
    33 Post(s)
    Tagged
    6 Thread(s)

    Default

    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).

    Aladin


  9. #9
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

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

    ******>
    EmployeeAgeSalary
    Larry1950000
    Jane2080000
    Tom2565000
    Joe2690000


    …you’d get…


    ******>
    Data
    AgeCount of EmployeeSum of SalaryMax of Salary
    20-25214500080000



Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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