Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
SyntaX TerroR
 
Posts: n/a
Default counting using multiple criteria

Hi,

I have a problem for which I can't seem to find a working solution. On the
one hand I have a vertical table with employee names, the number of years
they have been with the company, and all this sorted by the employee's age
(in years). This table will be updated from time to time, and as such it
doesn't have a fixed length.

On the other hand I have a table which shows the number of employees in a
particular age category (-20, 21-25, 26-30, etc) horizontally, and the number
of years they have been with the company (again in groups: 0-5 yrs, 5-10 yrs,
etc) vertically.

From this table, which is currently being updated manually, one can see that
for example, the company has 8 employees in the category 31 to 35 years, who
have been with the company 0 to 5 years, etc.

Is there a function to count the number of people who match both criteria to
fit into a specific cell of the table?
  #2   Report Post  
bj
 
Posts: n/a
Default

sumproduct() works well for this type of application
=sumproduct(--(and(Agerange=Age1,Agerange<=Age2),--(and(Servicerange=time1,Servicerange<=time2))
ther arrays in each section need to be the same size and cannot reference
the shorthand for entire rows or columns.

"SyntaX TerroR" wrote:

Hi,

I have a problem for which I can't seem to find a working solution. On the
one hand I have a vertical table with employee names, the number of years
they have been with the company, and all this sorted by the employee's age
(in years). This table will be updated from time to time, and as such it
doesn't have a fixed length.

On the other hand I have a table which shows the number of employees in a
particular age category (-20, 21-25, 26-30, etc) horizontally, and the number
of years they have been with the company (again in groups: 0-5 yrs, 5-10 yrs,
etc) vertically.

From this table, which is currently being updated manually, one can see that
for example, the company has 8 employees in the category 31 to 35 years, who
have been with the company 0 to 5 years, etc.

Is there a function to count the number of people who match both criteria to
fit into a specific cell of the table?

  #3   Report Post  
Jerry W. Lewis
 
Posts: n/a
Default

The standard approach for counting with multiple criteria is
=SUMPRODUCT((criteria1)*(criteria2)*...)
The explicit multiplication coerces the boolean arrays to 0's (FALSE)
and 1's (TRUE), so that the subsequent sum is equivalent to counting.

Jerry

SyntaX TerroR wrote:

Hi,

I have a problem for which I can't seem to find a working solution. On the
one hand I have a vertical table with employee names, the number of years
they have been with the company, and all this sorted by the employee's age
(in years). This table will be updated from time to time, and as such it
doesn't have a fixed length.

On the other hand I have a table which shows the number of employees in a
particular age category (-20, 21-25, 26-30, etc) horizontally, and the number
of years they have been with the company (again in groups: 0-5 yrs, 5-10 yrs,
etc) vertically.

From this table, which is currently being updated manually, one can see that
for example, the company has 8 employees in the category 31 to 35 years, who
have been with the company 0 to 5 years, etc.

Is there a function to count the number of people who match both criteria to
fit into a specific cell of the table?


  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Assuming that your results table is in E1:J7 (F1=0-20, G1=21-25, etc.
E2=0-5,E3-5-10, etc), then use

=SUMPRODUCT((length_of_service--LEFT($E3,FIND("-",$E3)-1))*(length_of_servi
ce<=--RIGHT($E3,LEN($E3)-FIND("-",$E3)))*(age=--LEFT(G$1,FIND("-",G$1)-1))*
(age<=--RIGHT(G$1,LEN(G$1)-FIND("-",G$1))))

where length_of_service is the years in the job column, age is the age in
years column.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"SyntaX TerroR" wrote in message
...
Hi,

I have a problem for which I can't seem to find a working solution. On

the
one hand I have a vertical table with employee names, the number of years
they have been with the company, and all this sorted by the employee's age
(in years). This table will be updated from time to time, and as such it
doesn't have a fixed length.

On the other hand I have a table which shows the number of employees in a
particular age category (-20, 21-25, 26-30, etc) horizontally, and the

number
of years they have been with the company (again in groups: 0-5 yrs, 5-10

yrs,
etc) vertically.

From this table, which is currently being updated manually, one can see

that
for example, the company has 8 employees in the category 31 to 35 years,

who
have been with the company 0 to 5 years, etc.

Is there a function to count the number of people who match both criteria

to
fit into a specific cell of the table?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting multiple cells using a criteria John Excel Discussion (Misc queries) 1 June 14th 05 04:51 PM
COUNTIF or SUMPRODUCT counting multiple criteria Kim Excel Worksheet Functions 1 June 1st 05 12:19 AM
COUNTIF or SUMPRODUCT counting multiple criteria Peo Sjoblom Excel Worksheet Functions 0 May 31st 05 11:40 PM
Counting rows based on criteria in multiple cells Margaret Excel Discussion (Misc queries) 11 December 2nd 04 11:04 PM
Counting "rows", i.e. simultaneous criteria for multiple cells gkline Excel Worksheet Functions 2 November 19th 04 07:30 AM


All times are GMT +1. The time now is 09:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"