+ Reply to Thread
Results 1 to 23 of 23

Head Count by criteria

  1. #1
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Head Count by criteria

    hey guys, i was wondering if someone could help me with this.
    I have attached a xls workbook about the problem I am faced with. Basically, I am trying to do a employee/contractor headcount by month, by certain criteria. The problem I am having relates to the fact that excel formulas do not carry over when applying filters. In orther words, Excel formulas only perform manipulations to the source data. The second worksheet in the workbook is the Summary tab, and basically is the end result that i am looking for. The first tab is the Data Source. PLEASE HELP!

    Thanks!!

    -Eric
    Attached Files Attached Files
    Last edited by eshen; 05-10-2010 at 03:53 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Head Counts by criteria

    So you want a table that summarizes only what you have filtered?

    See attached for setup...

    Formula used in C4:

    Please Login or Register  to view this content.
    copied across the table
    Attached Files Attached Files
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    thnx for the help =) but, yea you have the right idea, but your formula is counting duplicate values.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Head Counts by criteria

    Yes, this part controls the month:

    --(TEXT('Data Source'!$A$2:$A$86,"mmmm")=C$3)

  5. #5
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    wait..wats "mmmmm". as of right now, the table includes duplicate values. for example, January really only has 3 Full time employees for Department 1
    Last edited by eshen; 05-10-2010 at 12:56 PM.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Head Counts by criteria

    That is the format used in the TEXT function to display the MONTH name extracted from a date...

    So it looks at each cell in A2:A89 and converts the dates into the respective month name and then compares to then name in row 3 of your table.

  7. #7
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    ok i am confusing myself. give me a second to evaluate the formula lol sorry

  8. #8
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    thnx for helping btw.

    if apply a filter to the data source for January dates, Department 1, and Full Time employee, there are only 3 distinct employees. therefore the headcount for those criteria would be 3.

  9. #9
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    I used
    http://office.microsoft.com/en-us/ex...561181033.aspx
    as a reference.

    However, i couldnt get multiple criteria to work with that formula.

  10. #10
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    mmm anything?

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Head Counts by criteria

    I am trying to figure it out... amongst getting other things done.

  12. #12
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    oh sorry about that. take your time. I have been working on this all day and last week lol. Gets so frustrating when my formulas evaluate to #N/A. Doesn't help that the data I am working with is thousands of entries, which makes Formula evaluation imposssible.

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Head Counts by criteria

    Okay, try:

    Please Login or Register  to view this content.

    confirmed with CTRL+SHIFT+ENTER
    and not just ENTER and then copy down and over the matrix.

  14. #14
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    do i input this in cell C4?

  15. #15
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    im assuming this is an array formula correct?

  16. #16
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    oh cool. it works! now i just have to reproduce this on my original spreadsheet. THANKS!
    I'll let you know how it turns out.
    you've been a great help. I appreciate your time and effort. ^^

  17. #17
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Head Counts by criteria

    yes in C4 of my re-organized sheet.

    yes it is an array formula (confirm with CTRL+SHIFT+ENTER)
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    how do i maark this thread as SOLVED? ...

  19. #19
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Head Counts by criteria

    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

  20. #20
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Counts by criteria

    well i got the formula to work (thanks), now im just trying to evaluate how it works..
    could u explain
    OFFSET('Data Source'!$A$2:$A$86,ROW('Data Source'!$A$2:$A$86)-MIN(ROW('Data Source'!$A$2:$A$86)),,1))
    that line of code? wat does that do?

  21. #21
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Head Counts by criteria

    Have a look here:

    http://j-walk.com/ss/excel/eee/eee001.txt

    under the Power Formula Technique.

    There is another sample to download and play with here:

    http://www.contextures.com/xlfunctions04.html#Visible

  22. #22
    Registered User
    Join Date
    05-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Head Count by criteria

    so it is due to the nature of the subtotal function? specifically, SUBTOTAL does not allow the user to perform functions on individual cells since it groups everything together. therefore, OFFSET is used to return all cells within a range and then SUBTOTALed so that each cell gets its own subtotal (or 1)?

  23. #23
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Head Count by criteria

    Yes, I think you understand it correctly.

    The formula allows you to create an array of all the values in the range (as if it were unfiltering it) and assign a count of 1 or 0 to each row based on whether it was a filtered or non-filtered row... then it performs all the other functions based on all values in the list, and then it multiplies those results with each of the "subtotal" column results.. and if it multiplies by 1, it adds to the sum, if it multiplies by 0, it add 0 to the sum, so in the end, it only ends up summing/counting the items associated with your filtered list.

+ 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