+ Reply to Thread
Results 1 to 3 of 3

Get number of rows where month equals X AND where other criteria match

  1. #1
    Registered User
    Join Date
    07-01-2013
    Location
    London, UK
    MS-Off Ver
    Excel 2007, SP3
    Posts
    2

    Get number of rows where month equals X AND where other criteria match

    Hi there, I have searched this forum (and other Excel resources) for answers to my question but haven't been able to solve the problem yet, apologies if it transpires that I was being stupid and reading things wrong but I hope someone can help me anyway.

    Firstly, I am using Excel 2007, SP3. And I don't know if this is a setting but my version appears to be using column numbers instead of letters. So the first cell is "R1C1" instead of "A1". But now I've got my head around how it works (especially for conditional formatting) I quite like it this way.

    Anyway, my problem... I have a workbook that has three worksheets.

    Worksheet 1 (called "Error Log") is a list of issues. Each row is a separate issue.

    Worksheet 2 (called "Drop-downs") is just data for the drop-down menus in sheet 1.

    Worksheet 3 (called "Stats") is going to be statistics about sheet 1, but this is where I'm having trouble.

    In sheet 3 column 2 has dates formatted as MMMM so it just shows the month. For each month listed in sheet 3 I want to extract all of the following data from sheet 1:

    1) The total number of rows in sheet 1 where month is the same as the current line in sheet 3 (dates in sheet 1 are in column 1).

    2) The total number of rows in sheet 1 where month is the same as the current line in sheet 3 AND where company responsible is my company (company at fault is listed in column 3 of sheet 1).

    3) The total number of rows in sheet 1 where month is the same as the current line in sheet 3 AND where company responsible is NOT my company.

    4) The total number of rows in sheet 1 where month is the same as the current line in sheet 3 AND where company responsible is my company AND where team responsible equals my team (team at fault is listed in column 4 for sheet 1).

    Please can someone help? if anything is not clear (I'm aware this might be confusing) then please ask.

    Thank you.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,718

    Re: Get number of rows where month equals X AND where other criteria match

    I think you can use COUNTIF for the first one and COUNTIFS for the others, but your description is a bit confusing - perhaps you can add a workbook to make it a bit clearer (the FAQ describes how to).

    Pete

  3. #3
    Registered User
    Join Date
    07-01-2013
    Location
    London, UK
    MS-Off Ver
    Excel 2007, SP3
    Posts
    2

    Re: Get number of rows where month equals X AND where other criteria match

    Thanks for the replies guys, but with a bit more experimentation I have managed to solve my own problem. For the benefit of anybody else searching in future who may find this thread, here are the formulas I used:

    For the total number of rows per month:
    =SUMPRODUCT(--(MONTH('Error Log'!R2C1:R9997C1)=MONTH(RC[-1])),--(YEAR('Error Log'!R2C1:R9997C1)=YEAR(RC[-1])))
    Number of issues for the month attributable to my company:
    =SUMPRODUCT(--(MONTH('Error Log'!R2C1:R9997C1)=MONTH(RC[-4])),--(YEAR('Error Log'!R2C1:R9997C1)=YEAR(RC[-4])),--('Error Log'!R2C3:R9997C3='Drop-downs'!R2C2)+('Error Log'!R2C3:R9997C3='Drop-downs'!R4C2))
    Number of issues for the month NOT attributable to my company
    =SUMPRODUCT(--(MONTH('Error Log'!R2C1:R9997C1)=MONTH(RC[-7])),--(YEAR('Error Log'!R2C1:R9997C1)=YEAR(RC[-7])),--('Error Log'!R2C3:R9997C3<>'Drop-downs'!R2C2),--('Error Log'!R2C3:R9997C3<>'Drop-downs'!R4C2))
    Number of issues for the month attributable to my team
    =SUMPRODUCT(--(MONTH('Error Log'!R2C1:R9997C1)=MONTH(RC[-10])),--(YEAR('Error Log'!R2C1:R9997C1)=YEAR(RC[-10])),--('Error Log'!R2C4:R9997C4='Drop-downs'!R2C3))
    Oh, and I actually quite like the R1C1 style of cell naming, makes conditional formatting much easier for me, i just mentioned it as it would have been relevant for formulas / answers.

    Cheers all.
    Last edited by torshen; 07-01-2013 at 10:51 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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