Results 1 to 6 of 6
  1. #1
    Bertrand82 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    48

    Sum if value equals "cat"

    Hi,



    I have a query with different columns. One is column animal.

    I have two types of values in animal column; "Cat" and "Dog"

    Is i possible to create a total query which sums all the cats and excludes the dogs.

    Br Bertrand

  2. #2
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Create an additional Column

    myCats:iif(animal= "Cat",1,0)

  3. #3
    Bertrand82 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    48
    And the sum all the values from mycats?

  4. #4
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    You said you were using a Totals query. That will give you a Sum.

    There are different approaches depending on your needs.

    You could use a DCount as an alternative.

    What do you want to do with this information. A Totals query is not updateable so maybe this is not for you.

    If you simply want to display the result on a Form or Report then DCount may be better for you.

    So it is back to you to say what you need other than just a number.

  5. #5
    Bertrand82 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    48
    Ok, for now this is totally enough. thanks for assitance.

  6. #6
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    OK

    I feel like I have done little but if you are happy then fine.

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

Similar Threads

  1. Replies: 2
    Last Post: 11-14-2012, 04:47 PM
  2. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  3. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  4. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  5. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 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