Formula To Count a Number of Occurences Only Once If They Have The Same ID Number

SanFelippo

Board Regular
Joined
Apr 4, 2017
Messages
124
Hello,

So this is a bit difficult to explain, but I am going to do my best. I have 12 tabs for each month of the year (Jan, Feb, Mar, Apr, etc.), and then I have one more tab titled "Monthly Errors."

On the "Monthly Errors" tab, I have a column for each month starting in Column B. I then have in Column A the list of errors that could have occurred. I have an example of what one of the month tabs (i.e. Jan) looks like and what the "Monthly Errors" tab looks like at the bottom of this post. (We will use the "Jan" tab as the example in this, because all the month tabs are set up the exact same way).

How I need it to work:On the Jan tab, under the error column, there is going to be a drop down that will contain the following (The bolded text is the overall classification which you will find on the "Monthly Errors" Tab, while the items below each bolded text is what is in the drop down):

Ethn (App)

Ethnicity of Applicant: 1
Ethnicity of Applicant: 2
Ethnicity of Applicant: 3
Ethnicity of Applicant: 4
Ethnicity of Applicant: 5

Ethnicity of Applicant: Other


Ethn (Co-App)

Ethnicity of Co-Applicant: 1
Ethnicity of Co-Applicant: 2
Ethnicity of Co-Applicant: 3
Ethnicity of Co-Applicant: 4
Ethnicity of Co-Applicant: 5
Ethnicity of Co-Applicant: Other

<tbody>
</tbody>


Race (App)

<tbody>
</tbody>
Race of Applicant: 1
Race of Applicant: 2
Race of Applicant: 3
Race of Applicant: 4
Race of Applicant: 5
Race of Applicant: Amer. Indian/Principal Tribe
Race of Applicant: Other Asian
Race of Applicant: Other Pacific Islander

<tbody>
</tbody>


Race (Co-App)
Race of Co-Applicant: 1
Race of Co-Applicant: 2
Race of Co-Applicant: 3
Race of Co-Applicant: 4
Race of Co-Applicant: 5
Race of Co-Applicant: Amer. Indian/Principal Tribe
Race of Co-Applicant: Other Asian
Race of Co-Applicant: Other Pacific Islander

<tbody>
</tbody>

On the Jan tab, someone is going to type in the ID number into Column C of the application they are documenting an error for, and then they are going to choose whatever error they found from the list I have provided above. This means that an application ID can appear more than once on the Jan tab, as multiple errors could have been found with it (Reference the examples I provided below to get an idea of what I am talking about).


(Using Jan for our example) I need a formula on the "Monthly Errors" Tab that will search column B on the Jan tab and come up with a count of how many errors occurred. The tricky part is this (and it's easiest to use an example to explain), if one ID number has 3 errors for lets say, Ethnicity of Applicant: 2, Ethnicity of Applicant: 3, Ethnicity of Applicant: 4, then on the "Monthly Errors" tab, under Ethn (App) for Jan, that would only count as 1 in the overall count of how many applications had an Ethn (App) error.

See the example below for a clear picture of how I need it to work. Can anyone help me out?



"Jan" Tab
B
C
Error
ID Number
Ethnicity of Applicant: 2
6666
Ethnicity of Applicant: 3
6666
Ethnicity of Applicant: 4
6666
Race of Applicant: 1
7777
Race of Applicant: 2
7777
Ethnicity of Applicant: 1
8888
Ethnicity of Applicant: 2
8888
Race of Co-Applicant: 1
8888
Race of Applicant: Amer. Indian/Principal Tribe
9999
Race of Applicant: Other Asian
9999
Ethnicity of Applicant: 1
1010
Ethnicity of Applicant: 2
1010
Race of Co-Applicant: Other Pacific Islander
1010
Race of Applicant: 5
1010
Ethnicity of Co-Applicant: 1
1010
Ethnicity of Co-Applicant: 2
1010

<tbody>
</tbody>


So, on the "Monthly Errors" tab, the counts would be this:



"Monthly Errors" Tab
A
B
C
D
E
F
G
H
I
J
K
L
M
Error
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Ethn (App)
3
Ethn (Co-App)
1
Race (App)
3
Race (Co-App)
2

<tbody>
</tbody>
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Change A2:A4 of Monthy Errors to:

Ethnicity of Applicant
Ethnicity of Co-Applicant
Race of Applicant
Race of Co-Applicant

and in B2 control+shift+enter, not just enter, and copy down:

=SUM(IF(FREQUENCY(IF(ISNUMBER(SEARCH(A2,Jan!$B$2:$B$17)),Jan!$C$2:$C$17),Jan!$C$2:$C$17),1))
 
Upvote 0
I think this is just about what I need. However, it seems to be adding an additional 1 to the count for blank ID numbers. I know there shouldn't be a situation where you would have an error reported and you wouldn't have an ID attached to it, but for the sake of the count on the "Monthly Errors" tab not showing 1 for everything when there isn't anything filled out yet, could it be coded to not add to the count if the ID is blank?
 
Upvote 0
I think this is just about what I need. However, it seems to be adding an additional 1 to the count for blank ID numbers. I know there shouldn't be a situation where you would have an error reported and you wouldn't have an ID attached to it, but for the sake of the count on the "Monthly Errors" tab not showing 1 for everything when there isn't anything filled out yet, could it be coded to not add to the count if the ID is blank?

Control+shift+enter:

=IF(A2="","",=SUM(IF(FREQUENCY(IF(ISNUMBER(SEARCH(A2,Jan!$B$2:$B$17)),Jan!$C$2:$C$17),Jan!$C$2:$C$17),1)))

Is this what you meant?
 
Last edited:
Upvote 0
I mean if there is a situation like this, where the error is selected but no ID is filled out on the Jan Tab, it is still showing a count of 1 on the Monthly Errors Tab (probably because it is recognizing the blank cell as a unique identifier), but if no ID is entered, then it should be 0. Like I said, this situation shouldn't really ever happen, but I am trying to make this idiot proof:


Monthly Errors Tab
ABCDEFGHIJKLM
ErrorJanFebMarAprMayJunJulAugSepOctNovDec
Ethn (App)1
Ethn (Co-App)
Race (App)
Race (Co-App)

<tbody>
</tbody>


Jan Tab
BC
ErrorID Number
Ethnicity of Applicant: 2
Ethnicity of Applicant: 3
Ethnicity of Applicant: 4

<tbody>
</tbody>
 
Upvote 0
In B2 of Monthly Errors, control+shift+enter, and copy down:

=SUM(IF(FREQUENCY(IF(ISNUMBER(SEARCH(A2,Jan!$B$2:$B$17)),IF(ISNUMBER(Jan!$C$2:$C$17),Jan!$C$2:$C$17)),Jan!$C$2:$C$17),1))
 
Upvote 0

Forum statistics

Threads
1,215,217
Messages
6,123,675
Members
449,116
Latest member
HypnoFant

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