Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default "Nested" COUNTIF's

Hello, I have a simple application which retrieves a list of users from
an Active Directory, and exports it to an Excel file.

Each user is on a row with columns A-E containing name, user name,
department and a few other columns. Column F and the successive columns
contain the groups the user is member of - one group name per cell.

By using COUNTIF on the department column, I can easily find out how
many users are in a given department. Similarly, by using COUNTIF on
columns F-IV, I can count how many users are in a given group (assuming
each user only can be member of the given group once, which is a safe
assumption to make).

However, I'm having some trouble with the next calculation: How do I
count the number of users _in a given department_ who are members of a
given group? I can solve this by making auxiliary columns containing a
formula, but is it possible to solve by having the entire formula in a
single cell? (this calculation needs to be done for a lot of departments
and groups, so something other than a single-cell solution would get messy).

I appreciate any input!



Regards,
Nils Magnus
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default "Nested" COUNTIF's

=SUMPRODUCT(--(DeptRange=DeptNumber), --(GroupRange=GroupNumber))

Change DeptRange and GroupRange to whatever the range reference is for your
data (can't be and entire column unless using XL07) and DeptNumber and
GroupNumber to your criteria (or cell references that contain your criteria).


"Nils Magnus" wrote:

Hello, I have a simple application which retrieves a list of users from
an Active Directory, and exports it to an Excel file.

Each user is on a row with columns A-E containing name, user name,
department and a few other columns. Column F and the successive columns
contain the groups the user is member of - one group name per cell.

By using COUNTIF on the department column, I can easily find out how
many users are in a given department. Similarly, by using COUNTIF on
columns F-IV, I can count how many users are in a given group (assuming
each user only can be member of the given group once, which is a safe
assumption to make).

However, I'm having some trouble with the next calculation: How do I
count the number of users _in a given department_ who are members of a
given group? I can solve this by making auxiliary columns containing a
formula, but is it possible to solve by having the entire formula in a
single cell? (this calculation needs to be done for a lot of departments
and groups, so something other than a single-cell solution would get messy).

I appreciate any input!



Regards,
Nils Magnus

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default "Nested" COUNTIF's

Hello,

Thanks for your reply, but unfortunately the SUMPRODUCT function needs
it array parameters to be the same dimensions. The GroupRange is over
many columns (since there's one group in each cell, and each user is a
member of many groups), so I get a #VALUE error when I try to evaluate
the function.

When I set GroupRange to just a single column, it works (but then it
would only check if the first group the user is a member of is the
correct group).


Regards,
Nils Magnus


JMB wrote:
=SUMPRODUCT(--(DeptRange=DeptNumber), --(GroupRange=GroupNumber))

Change DeptRange and GroupRange to whatever the range reference is for your
data (can't be and entire column unless using XL07) and DeptNumber and
GroupNumber to your criteria (or cell references that contain your criteria).


"Nils Magnus" wrote:

Hello, I have a simple application which retrieves a list of users from
an Active Directory, and exports it to an Excel file.

Each user is on a row with columns A-E containing name, user name,
department and a few other columns. Column F and the successive columns
contain the groups the user is member of - one group name per cell.

By using COUNTIF on the department column, I can easily find out how
many users are in a given department. Similarly, by using COUNTIF on
columns F-IV, I can count how many users are in a given group (assuming
each user only can be member of the given group once, which is a safe
assumption to make).

However, I'm having some trouble with the next calculation: How do I
count the number of users _in a given department_ who are members of a
given group? I can solve this by making auxiliary columns containing a
formula, but is it possible to solve by having the entire formula in a
single cell? (this calculation needs to be done for a lot of departments
and groups, so something other than a single-cell solution would get messy).

I appreciate any input!



Regards,
Nils Magnus

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,344
Default "Nested" COUNTIF's

Hi Nils,

You can create a summary area which looks like this:


Flags Jars
Acct 2 0
Admin 1 0

I put the tilte Acct in C17 and Flags in B16.
The formula in the Flags (group) - Acct (department) is

=SUMPRODUCT(($C$2:$C$9=$C17)*($F$2:$IV$9=D$16))

--
Cheers,
Shane Devenshire


"Nils Magnus" wrote:

Hello, I have a simple application which retrieves a list of users from
an Active Directory, and exports it to an Excel file.

Each user is on a row with columns A-E containing name, user name,
department and a few other columns. Column F and the successive columns
contain the groups the user is member of - one group name per cell.

By using COUNTIF on the department column, I can easily find out how
many users are in a given department. Similarly, by using COUNTIF on
columns F-IV, I can count how many users are in a given group (assuming
each user only can be member of the given group once, which is a safe
assumption to make).

However, I'm having some trouble with the next calculation: How do I
count the number of users _in a given department_ who are members of a
given group? I can solve this by making auxiliary columns containing a
formula, but is it possible to solve by having the entire formula in a
single cell? (this calculation needs to be done for a lot of departments
and groups, so something other than a single-cell solution would get messy).

I appreciate any input!



Regards,
Nils Magnus

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default "Nested" COUNTIF's

Sorry, I misunderstood the group range is over several columns. A small
change:

=SUMPRODUCT((DeptRange=DeptNumber)*(GroupRange=Gro upNumber))

given your stated assumption that each user only can be member of the given
group once. otherwise, you could try:

=SUM((DeptRange=DeptNumber)*(SIGN(MMULT(--(GroupRange=GroupNumber),TRANSPOSE(COLUMN(GroupRan ge)/COLUMN(GroupRange))))))

array entered w/Cntrl+Shift+Enter (or you'll get #VALUE)




"Nils Magnus" wrote:

Hello,

Thanks for your reply, but unfortunately the SUMPRODUCT function needs
it array parameters to be the same dimensions. The GroupRange is over
many columns (since there's one group in each cell, and each user is a
member of many groups), so I get a #VALUE error when I try to evaluate
the function.

When I set GroupRange to just a single column, it works (but then it
would only check if the first group the user is a member of is the
correct group).


Regards,
Nils Magnus


JMB wrote:
=SUMPRODUCT(--(DeptRange=DeptNumber), --(GroupRange=GroupNumber))

Change DeptRange and GroupRange to whatever the range reference is for your
data (can't be and entire column unless using XL07) and DeptNumber and
GroupNumber to your criteria (or cell references that contain your criteria).


"Nils Magnus" wrote:

Hello, I have a simple application which retrieves a list of users from
an Active Directory, and exports it to an Excel file.

Each user is on a row with columns A-E containing name, user name,
department and a few other columns. Column F and the successive columns
contain the groups the user is member of - one group name per cell.

By using COUNTIF on the department column, I can easily find out how
many users are in a given department. Similarly, by using COUNTIF on
columns F-IV, I can count how many users are in a given group (assuming
each user only can be member of the given group once, which is a safe
assumption to make).

However, I'm having some trouble with the next calculation: How do I
count the number of users _in a given department_ who are members of a
given group? I can solve this by making auxiliary columns containing a
formula, but is it possible to solve by having the entire formula in a
single cell? (this calculation needs to be done for a lot of departments
and groups, so something other than a single-cell solution would get messy).

I appreciate any input!



Regards,
Nils Magnus




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default "Nested" COUNTIF's

Thanks JMB and Shane, your solution works great! :-)


Regards,
Nils Magnus



JMB wrote:
Sorry, I misunderstood the group range is over several columns. A small
change:

=SUMPRODUCT((DeptRange=DeptNumber)*(GroupRange=Gro upNumber))

given your stated assumption that each user only can be member of the given
group once. otherwise, you could try:

=SUM((DeptRange=DeptNumber)*(SIGN(MMULT(--(GroupRange=GroupNumber),TRANSPOSE(COLUMN(GroupRan ge)/COLUMN(GroupRange))))))

array entered w/Cntrl+Shift+Enter (or you'll get #VALUE)




"Nils Magnus" wrote:

Hello,

Thanks for your reply, but unfortunately the SUMPRODUCT function needs
it array parameters to be the same dimensions. The GroupRange is over
many columns (since there's one group in each cell, and each user is a
member of many groups), so I get a #VALUE error when I try to evaluate
the function.

When I set GroupRange to just a single column, it works (but then it
would only check if the first group the user is a member of is the
correct group).


Regards,
Nils Magnus


JMB wrote:
=SUMPRODUCT(--(DeptRange=DeptNumber), --(GroupRange=GroupNumber))

Change DeptRange and GroupRange to whatever the range reference is for your
data (can't be and entire column unless using XL07) and DeptNumber and
GroupNumber to your criteria (or cell references that contain your criteria).


"Nils Magnus" wrote:

Hello, I have a simple application which retrieves a list of users from
an Active Directory, and exports it to an Excel file.

Each user is on a row with columns A-E containing name, user name,
department and a few other columns. Column F and the successive columns
contain the groups the user is member of - one group name per cell.

By using COUNTIF on the department column, I can easily find out how
many users are in a given department. Similarly, by using COUNTIF on
columns F-IV, I can count how many users are in a given group (assuming
each user only can be member of the given group once, which is a safe
assumption to make).

However, I'm having some trouble with the next calculation: How do I
count the number of users _in a given department_ who are members of a
given group? I can solve this by making auxiliary columns containing a
formula, but is it possible to solve by having the entire formula in a
single cell? (this calculation needs to be done for a lot of departments
and groups, so something other than a single-cell solution would get messy).

I appreciate any input!



Regards,
Nils Magnus

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
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Nested "IF" With "And"and "OR" functions Richard Freist Excel Worksheet Functions 3 February 3rd 07 03:04 PM
Need more than 7 nested "IF" statements in Excel" James A Excel Discussion (Misc queries) 1 December 17th 06 02:02 AM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 09:20 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"