Question about Count Distinct

shdawson

Active Member
Joined
Jan 6, 2007
Messages
381
Good Morning,


Need to count the distinct entries in 1 field, based upon the entries in a 2nd field.

Need to get a list of project manager names from the project_manager field. Need to do that based upon what the entry is in the status field for their record (row), if that entry is a Y.

Thinking through SUMPRODUCT. Not seeing the light at the end of the path.

Thinking through http://office.microsoft.com/en-us/e...nique-values-in-a-data-range-HP003056118.aspx Still not seeing that light at the end of the path.

Hmmm......any thoughts?


Thanks,
S
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi,


Thanks for chiming in on this. :-)
Excel Workbook
EFG
1project_numberstatusproject_manager
2123Yjimmy
3456Ybilly
4789Ytommy
51111Njimmy
62222Njimmy
73333Nbilly
84444Ntommy
Sheet1
Excel 2003

Looking for a count of 3, since I have 3 distinctly differently project_manger names with the status of Y.

Thank you, kindly.


S
 
Last edited:
Upvote 0
IF status="Y"
Count Distinct project_manager

ELSE...go drink coffee (HA!)


How is that for a generic illustration?


S
 
Upvote 0
Try This


{=COUNT(IF($H$2:$H$8=INDEX($H$2:$H$8,MATCH(0,COUNTIF($L$1:L1,$H$2:$H$8),0)),IF($G$2:$G$8="Y",$F$2:$F$8)))}


Array Formula
 
Upvote 0
Hi,


Thanks for chiming in on this. :-)

Excel Workbook
EFG
1project_numberstatusproject_manager
2123Yjimmy
3456Ybilly
4789Ytommy
51111Njimmy
62222Njimmy
73333Nbilly
84444Ntommy
Sheet1
Excel 2003



Looking for a count of 3, since I have 3 distinctly differently project_manger names with the status of Y.

Thank you, kindly.


S
Try this array formula**:

=SUM(IF(FREQUENCY(IF(F2:F8="Y",MATCH(G2:G8,G2:G8,0)),ROW(G2:G8)-ROW(G2)+1),1))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Assumes no empty cells within the data range of column G.
 
Upvote 0
Hi,


Thanks for the effort, guys.

yogeshmaney, the formula returns 0. I then put the formula in L1, and it says there is an error.
T. Valko, the formula returns 3.


Not sure what is off with the formula, yogeshmaney. I will go with the formula from T. Valko with great thanks.


Kindest Regards,
S
 
Upvote 0
BTW..."Assumes no empty cells within the data range of column G."


That could happen, but not sure why. What will the formula return if there is an empty cell? I messed with it and found it returns #N/A.

Is there an easy way to edit the formula to account for empty cells? There is always a project manager coming and going, as well as a project going between active and non active status. To that end, it is an ever changing data range.


Thanks,
S
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top