+ Reply to Thread
Results 1 to 13 of 13

Counting Function (Non-blank, lookup, multiple categories)

  1. #1
    Registered User
    Join Date
    09-23-2013
    Location
    Calgary, AB
    MS-Off Ver
    Excel 2010
    Posts
    12

    Counting Function (Non-blank, lookup, multiple categories)

    Hello,

    First off, I have had great luck here! So I'm glad I've found a resource I can depend on for help. Here is my issue:

    I am working on an employee scheduling work sheet. I have employees who work in the field and employees who work in an office. When they take vacation time I need excel to record the total number of people within the office who are on vacation that day. I need to exclude the field workers from that list. I've included an example of what I'm doing.

    The yellow highlighted cells are manually input right now. I want them to be automatic using the information and format given. I'm open to suggestions.

    Thanks in advance - Jordan.
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Counting Function (Non-blank, lookup, multiple categories)

    Hi,

    Interesting. I imagine someone will come along with a fairly simple solution, but, without using a helper column, I can only come up with this - rather complicated - array formula (important that you know how to enter this type of formula in Excel) for now. In B9 and copy across:

    =COUNTIF(B4:B8,"Away")-SUM(--(IF(B4:B8="Away",IF(SUBTOTAL(3,OFFSET($B$14,MATCH($A$4:$A$8,$A$14:$A$18,0)-1,,,)),$B$14:$B$18))="Yes"))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    09-23-2013
    Location
    Calgary, AB
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Counting Function (Non-blank, lookup, multiple categories)

    I appreciate the reply.
    I'm trying to avoid array entry, since I'm helping someone else with this. The reason I'm avoiding it is twofold: first, I want them to be able to modify and understand the entry, and second, my understanding is that arrays have a higher chance to corrupt the file over time.

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Counting Function (Non-blank, lookup, multiple categories)

    Your first reason is perfectly understandable. As to your second, I can honestly say that I've never come across that as a reason for avoiding array formulas, and I have to confess I find it a little hard to believe; however, I'm sure you have reliable sources - could you tell me where you came across this information?

    Anyway, I trust that someone will come along and offer a non-array solution shortly.

    Regards

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,979

    Re: Counting Function (Non-blank, lookup, multiple categories)

    I would also be interested to learn more about array formulas causing corruption. It is not something I've come across before, or seen reported.
    Everyone who confuses correlation and causation ends up dead.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Counting Function (Non-blank, lookup, multiple categories)

    I too have not (yet?) seen or heard of array formulas causing that type of problem, and would be interested to see the source
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Registered User
    Join Date
    09-23-2013
    Location
    Calgary, AB
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Counting Function (Non-blank, lookup, multiple categories)

    Well, I had come across it searching for information on complex functions before. If I recall it was trying to make very specific formulae for conditional formatting. What I had previously read was that large arrays (since many of the sheets I use contain hundreds or even thousands of lines of data in excel) can corrupt or make a worksheet unstable. However, when I searched it just now I was unable to find any evidence of that. This leads me to believe I either misread, or it's an uncommon problem.

    Regardless, I may end up instituting the array function if I can't find another way.

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,979

    Re: Counting Function (Non-blank, lookup, multiple categories)

    Using array formulas badly can certainly have performance issues for your workbook but I have not heard of them actually corrupting a workbook before.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting Function (Non-blank, lookup, multiple categories)

    I'm not sure I understand what the OP wants but this normally entered formula returns the same results as the array formula.

    =COUNTIF(B4:B8,"Away")-SUMPRODUCT(--(B4:B8="Away"),SUBTOTAL(3,OFFSET($B$14,MATCH($A$4:$A$8,$A$14:$A$18,0)-1,,,)),--($B$14:$B$18="Yes"))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  10. #10
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Counting Function (Non-blank, lookup, multiple categories)

    Even me too don’t know what the exact requirement is but when seeing the data both Employee names are in same order so the below method will also get the same results.

    In B9 Cell

    =SUMPRODUCT(($B$14:$B$18="No")*(B4:B8="Away"))

    Drag it to right…


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  11. #11
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Counting Function (Non-blank, lookup, multiple categories)

    Oopss.. Since OP is using 2010 its better to use countifs instead of sumproduct

    In B9 Cell

    =COUNTIFS($B$14:$B$18,"No",B4:B8,"Away")

    Drag it right…

  12. #12
    Registered User
    Join Date
    09-23-2013
    Location
    Calgary, AB
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Counting Function (Non-blank, lookup, multiple categories)

    Wow thanks guys! I am in the middle of trying the two suggestions above. I have one issue: In my example I should have noted "Away" could instead be any one of 24 possibilities, so I was going to try and have it count non-blank cells. Is there a way to amend the above countifs statement to instead of counting "away", counting non-blank cells like the counta function?

    Edit: I just thought of this, I can just add 24 versions of the statement together. However, I am hoping there is a simpler way. Despite the fact that copy pasting is simple, more so I'm looking for more basic formula code.

  13. #13
    Registered User
    Join Date
    09-23-2013
    Location
    Calgary, AB
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Counting Function (Non-blank, lookup, multiple categories)

    Also - as a follow up question:

    If the order of the names do change, is Tony Valko's/an array solution better? I am trying to think of the same individual sheet, month to month. The name list will in fact be at the end of the year, so it's a multiple sheet workbook as opposed to all in the same sheet. Names can be added or taken away month by month, only the name list will be cumulative.

+ 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: 1
    Last Post: 05-15-2013, 06:55 AM
  2. Counting within Categories
    By Pedro's PhD in forum Excel General
    Replies: 1
    Last Post: 07-11-2011, 12:19 PM
  3. Counting categories
    By qcdorum in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2011, 02:39 AM
  4. Excel 2007 : Counting Categories From table
    By JoWales in forum Excel General
    Replies: 2
    Last Post: 01-27-2011, 07:31 AM
  5. Counting by categories and dates
    By vamshi57 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 12-12-2009, 07:41 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