+ Reply to Thread
Results 1 to 9 of 9

COUNTIF Row if Criteria is met

  1. #1
    Registered User
    Join Date
    01-29-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    10

    COUNTIF Row if Criteria is met

    HI

    i need help with a excel problem i am having, not sure if this requires more work outside of what excel can handle. I am also using excel 2010

    i have 2 worksheets under the one file

    One worksheet counts how many times a staff member is marked under a certain product code, (See screenshot 2 for sample data). Lets call this worksheet as TALLY
    while the 2nd worksheet has the dates of the year and staff members. Each day is represented as the staff member working under a certain product code. So the first sheet will tally up the codes separately and give me a read out for the year. (See screenshot for sample data). Lets call this worksheet as YEAR TO DATE

    Screenshot 2.JPG
    Screenshot.JPG

    My first worksheet has the following formula that works correctly for each product code and corresponding staff member
    =COUNTIF('YEAR TO DATE'!$5:$5,Lookup!B$2)
    but the data is calculated as i have specifically told the formula to look at row 5 to count the data for Staff 1. and i would do the same for the rest of the staff but telling it to look at a different row.

    but as staff members arent always in the same row for the YEAR TO DATE for the entire year, as we have new starters added, i would like to use some sort of lookup that mentions

    whatever is in the TALLY worksheet column A for each staff member, find the relevant row in YEAR TO DATE and countif the requried formula as above, rather than me having to specifically say in the formula go to row 1 etc

    is this possible in the realms of excel formula's? or would i need to create custom actions?

    if it helps me by uploading a sample version of what i need then i will do so

    thanks
    Attached Images Attached Images
    Last edited by Pamam; 01-29-2012 at 10:15 PM. Reason: SOLVED

  2. #2
    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
    48,636

    Re: COUNTIF Row if Criteria is met

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook. Don't upload a picture when you have a workbook question. None of us is inclined to recreate your data. Upload the workbook and manually add an 'after' situation so that we can see what you expect. In addition clearly explain how you get the results..
    To attach a file to your post, you need to be using the main 'New Post' or 'New Thread' page and not 'Quick Reply'.
    To use the main 'New Post' page, click the 'Post Reply' button in the relevant thread.

    On this page, below the message box, you will find a button labelled 'Manage Attachments'.
    Clicking this button will open a new window for uploading attachments.

    You can upload an attachment either from your computer or from another URL by using the appropriate box on this page.
    Alternatively you can click the Attachment Icon to open this page.

    To upload a file from your computer, click the 'Browse' button and locate the file.

    To upload a file from another URL, enter the full URL for the file in the second box on this page.
    Once you have completed one of the boxes, click 'Upload'.

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    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


  3. #3
    Registered User
    Join Date
    01-29-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: COUNTIF Row if Criteria is met

    Sorry apologies

    attached is the sample file
    Sample_DataHelp.xlsx

    my after situation would be the same value as whats in the Tally worksheet, but instead of having a hard link to a row (Staff 1 is row 5), the row would be referenced by finding the team member and corresponding row from the 2011 to 2012 worksheet.

    i have also played with a Match formula, by finding the corresponding row the 'Staff 1' is in '2011 to 2012' worksheet, but cannot get the value of that in my COUNTIF formula,

    so a little stuck

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: COUNTIF Row if Criteria is met

    Tally!B5, copy down & across.

    =COUNTIF(INDEX('2011 to 2012'!$C:$XFD,MATCH($A4,'2011 to 2012'!$B:$B,0),0),B$2)
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  5. #5
    Registered User
    Join Date
    01-29-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: COUNTIF Row if Criteria is met

    Thankyou Haseeb A

    that is exactly what i am after

    Perfect

    i have now marked this as solved

  6. #6
    Registered User
    Join Date
    01-29-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: COUNTIF Row if Criteria is met

    Hi All,

    this answer has done me wonders for the past 3 years

    now I have to take it to the next level and I am a bit stuck

    the first post is solved by giving me a cumulative count of the Financial year to date

    what I need to do is now breakdown the count into months, quarters, half yearly so I can do different graphs/comparisons

    what would be the best way to add to this spreadsheet to get this going?
    should I be adding new rows in my data tab to help me reference months, quarters, halves and then base my calculations on that?

    any help would be appreciated

    ive attached an updated spreadsheet sample_datahelp.xlsx
    Last edited by Pamam; 04-29-2015 at 01:16 AM. Reason: added attachment

  7. #7
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: COUNTIF Row if Criteria is met

    if your going to be doing reporting and dissecting it
    you may want to look into crosstabing the data and putting it into a pivot table
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  8. #8
    Registered User
    Join Date
    01-29-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: COUNTIF Row if Criteria is met

    thanks for the quick reply

    ill take a closer look and reply when I understand what you have done here

    thanks

    still open for other suggestions without the need to re-breakdown the data (if possible)

  9. #9
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: COUNTIF Row if Criteria is met

    fyi i didn't manually break down the info if you want to know i used a crosstable to list macro

    http://whatapalaver.co.uk/2009/07/ex...-to-flat-list/
    which i found from this site and modified

    Please Login or Register  to view this content.
    then i added formula for quarters (i assumed you want Australian fin year quarters) and month

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: COUNTIF Row if Criteria is met

    if you dont want to run the cross tab again once you have set it up

    use this formula in Sheet1 cell - C2 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    it will update based on sheet 2011 to 2012 then click refresh on pivot table and the data is updated

+ 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