+ Reply to Thread
Results 1 to 16 of 16

Counting based on 3 values

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Counting based on 3 values

    Hi All,

    I hope someone can help with this.

    I have attached a sample for convenience.

    I am looking to be able to count in a table the word "Spare" where in matches the 2 criteria in a table range.

    In the attached, I want to count the amount of times "JOHN" and "MARK" are "spare" in the Weeks where the numbers are in the table.

    I have named the range where the data sits called "DataTable"

    I hope this makes sense what I am trying to achieve

    Thanks in advance

    Spare Count1.xlsx

    John

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Counting based on 3 values

    With an pivot table.

    See the attached file.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting based on 3 values

    Please use this formula in J3

    Run it across and down

    =SUMPRODUCT(($A$2:$A$43=$I3)*(($B$2:$B$43=J$2)*(($D$2:$D$43="Spare"))))
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Counting based on 3 values

    Thanks both for the responses - AlKey your solution best suits my needs as pivot tables dont update once you change the data if i'm correct?

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting based on 3 values

    Thank you for your feedback!

    PivotTable can refresh on open under PivotTable options settings. It can work if new data is of the same size and range. Otherwise you would have to do it manually to adjust ranges or use VBA.

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting based on 3 values

    Please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

  7. #7
    Registered User
    Join Date
    03-21-2012
    Location
    Bay Area, California
    MS-Off Ver
    Excel 2011 & 2010
    Posts
    52

    Re: Counting based on 3 values

    Spare Count1_Reply.xlsxjShaw82,

    Please see attached -- I used the COUNTIFS formula.

    HTH =)

  8. #8
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Counting based on 3 values

    the COUNTIFS formula seems to calculate quicker - thanks NU2vba!

  9. #9
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Counting based on 3 values

    Hi All, I have been requested to make a change the to spreadsheet that I am developing. Now have been asked to count the amount of "Spare" based on the month I have reattached a sample. The list in the sample would actually be a list for the whole year, i've just cut it down. I'm thinking the SUMPRODUCT would be best but not sure how to match "Nov" to the date range.

    Thanks John

    Spare Count2.xlsx

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting based on 3 values

    You A column missing names after row 64. Please add missing info.

  11. #11
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Counting based on 3 values

    My apologies.

    Spare Count2.xlsx

  12. #12
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting based on 3 values

    Here a new formula:

    =SUMPRODUCT(($A$2:$A$85=$I3)*((TEXT($C$2:$C$85,"MMM")=J$2)*(($D$2:$D$85="Spare"))))

  13. #13
    Forum Contributor
    Join Date
    08-14-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    257

    Re: Counting based on 3 values

    Thanks AlKey - do you know if it may be possible to do this with COUNTIFS. The SUMPRODUCT is great but its slow calculating? I've tried messing with it but cant get it to work?

  14. #14
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Counting based on 3 values

    Enter this in J3 and copy down and across:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  15. #15
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting based on 3 values

    The problem here is that COUNTIFS would have to accept a formula as a criteria in order to mach month. About the speed of COUNTIFS vs SUMPRODUCT I really don't know. I believe that SUMPRODUCT in this case is the solution.

  16. #16
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Counting based on 3 values

    Seeing that you changed the criteria to Months, use a helper column E and enter this formula in E2 and copy down the length of the data:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In J3 enter this formula and copy down and across:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. Counting Unique Values based on several criteria
    By GowHow in forum Excel General
    Replies: 2
    Last Post: 04-25-2012, 10:16 PM
  2. [SOLVED] Counting based on DATE values
    By Laur3l in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-05-2012, 04:07 PM
  3. Excel 2007 : Counting results based on 2 values
    By spear21 in forum Excel General
    Replies: 3
    Last Post: 09-30-2011, 08:49 AM
  4. Counting Values Based on Criteria
    By zachharriman in forum Excel General
    Replies: 4
    Last Post: 03-10-2008, 05:56 PM
  5. [SOLVED] Counting based on values in two columns?
    By Brother of Andrew in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-18-2005, 07:15 PM

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