Formulas to count including Unique Numbers

Graham C1600

Board Regular
Joined
Feb 17, 2018
Messages
96
Office Version
  1. 365
Hi,

I've tried this before but ended up going around in circles because i was not asking the right questions. Hopefully the below will clear all this up.

User IDNameLast LogonUTCModelType
1Gary01/01/2019NoADCOL
1Stephen02/01/2019NoRELCOL
1BrianNoRELCOL
2Graham05/03/2019YesRELSIM
3SteveNoRELCOL
4Clare06/05/2019YesRELSIM
4TrevYesADCOL
5Simon03/03/2018NoRELCOL
6RichNoADSIM
7Darren05/06/2019NoRELCOL
8John01/04/2018NoADSIM
8AndrewNoRELSIM
9OliverYesRELSIM

<colgroup><col><col><col><col span="3"></colgroup><tbody>
</tbody>

So work on the assumption that the User ID's is Column A and so on. So the formulas I need will be going into Column G and beyond.

1st query. How many unique User ID’s are there with the following criteria – There is text in the Last Logon field and also the UTC is=”No”. So in this example the answer would be 3. This is User ID 1,5 & 8.
2nd query. As above but I now need to see how many unique User ID’s there are with the following criteria – The Last Logon field is blank and the UTC is =”No”. The important part with this one is that all of the same User ID’s must meet this requirement. So for instance User ID 1, Brian has not logged on and his UTC is “No”. But Gary and Stephen have logged on so this User id is not to be counted. So using this method the answer would be 2. This would be Rich and Steve.
3rd query. I need to count the total amount of User ID’s where at least 1 person has data in the Last logged on field and the UTC = “No”. This is not unique and I need a total. In this case it would be 5 (Gary, Stephen, John, Darren, Simon)
4th query. I need to count the total amount of User ID’s where at least 1 person has data in their Last Logon box and the UTC =”No”. This count needs to be User ID’s that are the same for instance John has met this criteria but we also need to include Andrew in the count because he has the same User ID. So in this scenario the count would be 7 (Gary, Stephen, Brian, Simon, Darren, John, Andrew)
4th query. I need to count the total amount of User ID’s where there is no data in the Last Logon Field and the UTC=”No”. This count needs to be similar to the 2nd query in that if there is a User ID that meets this requirement and another person with the same User ID does not meet the requirement then we need to disregard these users. So in this query the answer would be 2.
5th query. I need to count the how many Unique User ID’s there are that meet the following criteria – UTC=”No” –Model =”AD” Type=”SIM”. In this case the answer is 2 (Rich & John)
6th query. I need to count the total of User ID’s that meet the following criteria – UTC=”No” Model=”REL” Type=”COL”. In this case the answer is 5 (Stephen, Steve, Brian,Simon,Darren)
7th query. I need to count the total of User ID’s that meet this criteria – UTC=”No” Model=”REL” Type=”COL” and also where there is data in the Last Logon field. So in this scenario the count would be 3 (Stephen, Simon , Darren)

Thanks in advance.
 
Hi M,

Thanks again for correcting me. Yes yo are correct. It would be 6 because as you say Brian should have been counted.
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi M,

This formula works when I do it small scale on the test data I use. When I try to expand it out onto the real data I just get an N/A in the cell. The formula I'm trying to use is as follows :-

=SUM(IF(FREQUENCY(IF(ISNA(MATCH(A2:A500,IF((I2:I500<>"")+(K2:K500="Yes"),A2:A500),0)),MATCH(A2:A500,A2:A500,0)),ROW(A2:A500)-ROW(A2)+1),1)) - followed by Ctrl/Shift & enter.

Any ideas on my mistake ?

Thanks
 
Upvote 0
Hi M,

Thanks again for correcting me. Yes yo are correct. It would be 6 because as you say Brian should have been counted.


When I tested the formula I saw that I was wrong, too ;)
Actually the answer should be 7 - Andrew should be counted as well.

Try
=SUM(IF(D2:D14="No",--ISNUMBER(MATCH(A2:A14,IF((C2:C14<>"")*(D2:D14="No"),A2:A14),0))))
Ctrl+Shift+Enter

M.
 
Last edited:
Upvote 0
Hi M,

This formula works when I do it small scale on the test data I use. When I try to expand it out onto the real data I just get an N/A in the cell. The formula I'm trying to use is as follows :-

=SUM(IF(FREQUENCY(IF(ISNA(MATCH(A2:A500,IF((I2:I500<>"")+(K2:K500="Yes"),A2:A500),0)),MATCH(A2:A500,A2:A500,0)),ROW(A2:A500)-ROW(A2)+1),1)) - followed by Ctrl/Shift & enter.

Any ideas on my mistake ?

Thanks

What query are you referring to? Are there blank cells in A2:A500? Or cells with errors?

M.
 
Upvote 0
See if this works

=SUM(IF(FREQUENCY(IF(A2:A500<>"",IF(ISNA(MATCH(A2:A500,IF((I2:I500<>"")+(K2:K500="Yes"),A2:A500),0)),MATCH(A2:A500,A2:A500,0))),ROW(A2:A500)-ROW(A2)+1),1))
Ctrl+Shift+Enter

M.
 
Upvote 0
Thanks M.

4
th
query. I need to count the total amount of User ID’s where at least 1 person has data in their Last Logon box and the UTC =”No”.

This one now. The answer should be 5.

Everything else is working so thanks.
 
Upvote 0
Thanks M.

4
th
query. I need to count the total amount of User ID’s where at least 1 person has data in their Last Logon box and the UTC =”No”.

This one now. The answer should be 5.

Everything else is working so thanks.

Hi M,

Bad wording from me.

I need to count the total amount of User ID’s where there is data in their Last Logon box and the UTC =”No”.

Gary
Stephen
Simon
Darren
John
Thanks

<colgroup><col></colgroup><tbody>
</tbody>

<colgroup><col></colgroup><tbody>
</tbody>
<strike></strike>
 
Upvote 0
Thanks M works fine.

Next puzzle.

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]I need to count the total amount of User ID’s where there is no data in the Last Logon Field and the UTC=”No”. This count needs to be similar to the 2nd query (=SUM(IF(FREQUENCY(IF(ISNA(MATCH(A2:A14,IF((C2:C14<>"")+(D2:D14="Yes"),A2:A14),0)),MATCH(A2:A14,A2:A14,0)),ROW(A2:A14)-ROW(A2)+1),1))) in that if there is a User ID that meets this requirement and another person with the same User ID does not meet the requirement then we need to disregard these users. So in this query the answer would be 2. which would be Steve & Rich. We cannot count Brian as both Gary & Stephen have logged in and they have the same user ID. Hope this makes sense.[/FONT]
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,952
Members
448,535
Latest member
alrossman

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