Countif function in Access

dougdrex

Board Regular
Joined
Sep 27, 2013
Messages
79
I'm using Access 2010 and need to perform the equivalent of Countif in an Access database.

I'm trying to count the number of times an ID appears in one table that match the ID number in a specific record in another table.

For example the ID in Table 1 is 123. That same ID might be in the other table 4 times, or perhaps not at all. I just need to perform a Countif to calculate it in a query.

Any help is greatly appreciated!


Thanks!
Doug
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
A little SQL for this:
Code:
select
	t1.id, count(t2.id) as CountOfID
from 
	table1 t1
	left join table2 t2
	on t1.id = t2.id
group by 
	t1.id
order by
        t1.id
 
Last edited:
Upvote 0
A little SQL for this:
Code:
select
    t1.id, count(t2.id) as CountOfID
from 
    table1 t1
    left join table2 t2
    on t1.id = t2.id
group by 
    t1.id
order by t1.id

My query has another couple of fields that are already calculated. Is there a way to incorporate this as part of a query that already exists? Or creating another calculated field?
 
Upvote 0
The answer to that depends on the other query you want to incorporate this into - maybe, maybe not.
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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