Count of Duplicates

S

Schwimms

I have a row in a query called job number. These job numbers sometimes get
duplicated/triplicated/quadruplicated ...etc. I need to insert a formula into
this query to count the number of times that job number shows up. Can anyone
help?
 
O

Ofer Cohen

You can add another column in the query with DCount

CountOfJobNumber: DCount("*","TableName","[job number] = " & [job number])

Replace TableName with the real table name
If [job number] it's not the field name, then replace it

If the [job number] field is text, then replace the dcount with

CountOfJobNumber: DCount("*","TableName","[job number] = '" & [job number] &
"'")

adding single quotes
 
S

Schwimms

This works, Thank you, although it is very time consuming. Is there a shorter
way. I did have to use your second formula because the data was text.

Ofer Cohen said:
You can add another column in the query with DCount

CountOfJobNumber: DCount("*","TableName","[job number] = " & [job number])

Replace TableName with the real table name
If [job number] it's not the field name, then replace it

If the [job number] field is text, then replace the dcount with

CountOfJobNumber: DCount("*","TableName","[job number] = '" & [job number] &
"'")

adding single quotes
--
Good Luck
BS"D


Schwimms said:
I have a row in a query called job number. These job numbers sometimes get
duplicated/triplicated/quadruplicated ...etc. I need to insert a formula into
this query to count the number of times that job number shows up. Can anyone
help?
 
O

Ofer Cohen

Usually I'm creating another query that count the number of entries, and then
I add that query to the first query, linked by the job number field

Something like

SELECT [job number] , Count([job number]) AS CountOfJobs
FROM TableName
GROUP BY [job number]

Then link it and display the count, I think it wil be quicker

--
Good Luck
BS"D


Schwimms said:
This works, Thank you, although it is very time consuming. Is there a shorter
way. I did have to use your second formula because the data was text.

Ofer Cohen said:
You can add another column in the query with DCount

CountOfJobNumber: DCount("*","TableName","[job number] = " & [job number])

Replace TableName with the real table name
If [job number] it's not the field name, then replace it

If the [job number] field is text, then replace the dcount with

CountOfJobNumber: DCount("*","TableName","[job number] = '" & [job number] &
"'")

adding single quotes
--
Good Luck
BS"D


Schwimms said:
I have a row in a query called job number. These job numbers sometimes get
duplicated/triplicated/quadruplicated ...etc. I need to insert a formula into
this query to count the number of times that job number shows up. Can anyone
help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top