Results 1 to 7 of 7
  1. #1
    voro is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    9

    Countif

    Hi

    I ve been trying to create a query that would countif but no luck. The thing is i am not trying to count if there is, for ex. "no" in a column coz that is sorta simple.
    The thing im looking for may b simple as well but not for me
    I have 10 000 different Emp IDs and i want to count how many time a specific ID appears in a column as i am interested in those which appear more then once.
    Could i kindly ask for your help please.
    Thanks in advance
    Regards
    Peter

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Assuming your [Emp ID] is a text value considering you're looking for a specific value
    Count * as ItemCount FROM TableName WHERE ([Emp ID] Like '*XXX')
    if the you are looking for something that ends in the string you're looking for
    Count * as ItemCount FROM TableName WHERE ([Emp ID] Like 'XXX*')
    if the string you're looking for is at the beginning of your field
    Count * as ItemCount FROM TableName WHERE ([Emp ID] Like '*XXX*')
    if the string your looking for can be anywhere in the search field.

  3. #3
    voro is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    9
    Thanks alot for your feedback.

    I am not looking for a specific value if i understood you correctly. I wish a number to appear (in a column called, let say "count" which is allocated next to the emp id column) that will indicate how many times a particular emp id appears in a range. As if... Countif(range, criteria) where criteria are my emp IDs lets say from A1 to A10 000
    Hope im clear
    Thanks
    Reg
    Peter

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If you're looking for a count of ID's in a range you'd do

    Count * as ItemCount FROM TableName WHERE ([Emp ID] between 'a1' and 'a10')

    Without knowing the actual values that can appear in your table I can't really give you a good 'between' nor do I know how you're attempting to feed it values for instance if you're reading an upper bound and lower bound of your search criteria in a form and using that to drive your query the statement would obviously change with it.

  5. #5
    voro is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    9
    Thanks again for feedback. You have either already answered my question (and im too begginer to have noticed it) or i am just not clear enough.
    Let me try one last time plase.

    I have a table called Employees. In my table in col A i have 10000 Emp IDs. I wish to create a query that will in cell B1 count how many times emp id from cell A1 appears in col A. Then the same thing in cell B2 for emp id from cell A2 and so on untill cell A10000
    So the query would "check" how many times emp id from cell A1 appears in the range A1 to A10000. If it appears 3 time then it just gives me number three. Same story with emp id from cell a2, a3, a4 etc. So each emp id would have corresponding number in col B representing how many times it appears in col A.
    ufffff
    if that doesnt work nothing will hehehe mayb i am just not gud at explanations.
    Many thanks in advance for your attempts of support.
    Regards
    Peter

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Everything you are asking for is a simple aggregate query click the sigma button (greek letter E) in your query a new row will appear that says TOTAL. Just play around with it until you get what you want.

    Count * as ItemCount, EMP_ID FROM TableName WHERE ([Emp ID] between 'a1' and 'a10')

  7. #7
    voro is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    9
    Thaaaaaaaank You very much Friend

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Countif in Access
    By Rosekv in forum Access
    Replies: 1
    Last Post: 06-19-2013, 05:58 AM
  2. Countif would make it so easy.
    By Huddle in forum Access
    Replies: 3
    Last Post: 06-08-2012, 12:27 PM
  3. Advanced CountIf Query
    By therzakid in forum Queries
    Replies: 2
    Last Post: 07-27-2011, 10:45 PM
  4. Similar to countif
    By JonHFL in forum Access
    Replies: 2
    Last Post: 06-04-2010, 10:55 AM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums