+ Reply to Thread
Results 1 to 7 of 7

Selective count with two variables

  1. #1
    Registered User
    Join Date
    02-23-2017
    Location
    Tasmania
    MS-Off Ver
    o365 Pro
    Posts
    10

    Selective count with two variables

    Hi All,

    I am stuck trying to create a formula to selectively count values based on the data in two columns. As attached is a spreadsheet of the number of times it rained dogs or cats over a number of months. I want to know how many times it rained dogs in a particular month, and how many times it rained cats in a particular month!

    Any help would be greatly appreciated!

    Thanks!
    Attached Files Attached Files

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Selective count with two variables

    try: =SUMPRODUCT((Table5[Raining]=$E$1)*(MONTH(Table5[Date])=$F$1))
    Attached Files Attached Files
    Last edited by sandy666; 04-03-2017 at 08:53 PM. Reason: Updated with TMS solution

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Selective count with two variables

    Use a Pivot Table and group by month
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    02-23-2017
    Location
    Tasmania
    MS-Off Ver
    o365 Pro
    Posts
    10

    Re: Selective count with two variables

    Thanks All,

    Is there a way to group the Pivot Table data by singular month, rather than having multiple instances of for example January, or 5 instances of February for cats etc?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Selective count with two variables

    Right click on one of the dates listed. From the dialogue, choose Group and then Month

  6. #6
    Registered User
    Join Date
    02-23-2017
    Location
    Tasmania
    MS-Off Ver
    o365 Pro
    Posts
    10

    Re: Selective count with two variables

    Thanks All, fantastic support!

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Selective count with two variables

    You're welcome. Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 12-11-2012, 05:04 AM
  2. [SOLVED] Count if statement with selective Counting
    By brharrii in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-07-2012, 02:53 PM
  3. count with two variables
    By nigelog in forum Excel General
    Replies: 6
    Last Post: 10-12-2010, 11:05 AM
  4. Count functions with variables
    By JohnathanC in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2010, 12:11 PM
  5. Selective Count function
    By greggga in forum Excel General
    Replies: 1
    Last Post: 05-15-2009, 10:49 AM
  6. Count using 2 variables
    By LarryC in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-09-2008, 09:12 AM
  7. How do I count to different variables in excel
    By Jonhart75 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1