+ Reply to Thread
Results 1 to 11 of 11

Count group direfently if one parameter is different

  1. #1
    Registered User
    Join Date
    02-09-2015
    Location
    Belgrade
    MS-Off Ver
    MS Office 2016
    Posts
    21

    Count group direfently if one parameter is different

    Please help me with this octopus of a formula. Here's the problem: i need to keep the track of people who use alcohol at work and to show that information as sum of all inspections and number of inspections without problems, where one inspection can be done on one or more people. Problem is also that people can be our own workers or contractors. So lets say we have alcotested one group of 10 people which is consisted of 7 own workers and 3 of contractor. In sum that is 2 inspections (one of own workers and one of contractors). Problem is that i need formula to show if one group had one or more workers under influence of alcohol then whole inspection of the group must be shown as "positive".
    Here's the example of data:
    A.date B.location C.worker D.own/contractor E.positive (y/n)

    by combining every data from every column i get for example "date&location&own" in column "F" for those 10 workers. It will only differ in "own/contractor"

    From that i can calculate how much inspections there were with formula =IF(COUNTIF(F:F;F:F)=0;"";1/COUNTIF(F:F;F:F)) and it would show as 1 inspection of own and 1 inspection of contractor workers. So for my report it would say:
    number of inspections: 2
    number of inspections W/O problems: 2

    Problem is how to calculate number of inspections when one or more people have been drinking (lets say only in own workers group) and when the report would have to say:
    number of inspections: 2
    number of inspections W/O problems: 1 (only one because contractor group didn't have any problems)

    So, how to calculate group differently if only one worker from group did drink
    Last edited by gesaugen; 02-09-2015 at 10:45 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Count group direfently if one parameter is different

    Try instead of number 1 (or 2) write:

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


    Like this:

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

  3. #3
    Registered User
    Join Date
    02-09-2015
    Location
    Belgrade
    MS-Off Ver
    MS Office 2016
    Posts
    21

    Re: Count group direfently if one parameter is different

    it only increases the number of total inspections by x2. that's now that I'm after... the number of inspections is calculated ok, so number 1 in formula is ok

    i need to get number of inspections with positive tested workers. That parameter in column "E" (y/n) hasn't been calculated at all because i don't know how to calculate it in to get number of only positive inspections

  4. #4
    Registered User
    Join Date
    02-09-2015
    Location
    Belgrade
    MS-Off Ver
    MS Office 2016
    Posts
    21

    Re: Count group direfently if one parameter is different

    double post

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

    Re: Count group direfently if one parameter is different

    I made up some dummy data and perhaps this will do what you want.

    I used a Pivot Table for a summary of data.
    Attached Files Attached Files
    <---------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

  6. #6
    Registered User
    Join Date
    02-09-2015
    Location
    Belgrade
    MS-Off Ver
    MS Office 2016
    Posts
    21

    Re: Count group direfently if one parameter is different

    Quote Originally Posted by newdoverman View Post
    I made up some dummy data and perhaps this will do what you want.

    I used a Pivot Table for a summary of data.
    Thanks for trying but it is not exactly what i want because i need result as final number (managers want pure "yes/no" data and not something that they need to think of what are they looking at)

    So here's my table with the problem - I have problems with uploading via forum console so I've uploaded via file share. here's the link:
    http://s000.tinyupload.com/index.php...06778502170000

    the result I need is colored yellow in table to the right. I've manually entered in yellow fields the numbers which i should get via this formula I'm asking for here on forum. everything else is calculated

    So in the data sheet to the left I've colored with light green all inspections over contractor workers and white ones are own, just to show more easily what we are looking at.
    It can be seen that in January there were 3 inspections of contractor and 3 of own worker and it happened in 3 different days. Own workers only had one negative inspection, that at 5.1.2015 while contractor had two, those at 5.1 and 6.1.

    as shown in the table to the right, i need formula to show only number of inspections without anyone been positively tested

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Count group direfently if one parameter is different

    Please use Forum to upload attachments.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    I've add extra column.
    According to it I've got different output than your example.

    Why you got 1 in 2nd month?
    I guess it's a 0.

    Here are mine outputs:

    In January we have 2C (5.1. and 6.1.) and 1O (5.1.)
    In February 0
    In May 1C (8.5.)
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-09-2015
    Location
    Belgrade
    MS-Off Ver
    MS Office 2016
    Posts
    21

    Re: Count group direfently if one parameter is different

    Quote Originally Posted by zbor View Post
    Please use Forum to upload attachments.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    I tried but it won't upload my files, it says eror. I have proxy in my company so maybe something is messing upload up.

    Quote Originally Posted by zbor View Post
    I've add extra column.
    According to it I've got different output than your example.

    Why you got 1 in 2nd month?
    I guess it's a 0.

    Here are mine outputs:

    In January we have 2C (5.1. and 6.1.) and 1O (5.1.)
    In February 0
    In May 1C (8.5.)
    hvala!

    I got 1 in 2nd month because ther was only one inspection in 2nd month and it didn't have anyone positive. so its 1 inspection and 1 inspection without "y"

    your solution works only halfway: it stops when it reaches row no.100. from there onwards calculation stops and gives me error formula warning

    Also it shows number of inspections with Y but i need it other way: number of inspections without "Y"

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Count group direfently if one parameter is different

    Yes.
    In column I and rows 4 and 6 you need to extend range:

    For example:

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


    You can select whole column but it will be slow so I suggest to put some limited range.

  10. #10
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Count group direfently if one parameter is different

    Got it.
    Fixed now.

    Range extended to 10.000
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-09-2015
    Location
    Belgrade
    MS-Off Ver
    MS Office 2016
    Posts
    21

    Re: Count group direfently if one parameter is different

    zbor, than you very very much! It works perfectly!
    this is way out of my excel knowledge

+ 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: 2
    Last Post: 10-06-2014, 08:15 AM
  2. Replies: 8
    Last Post: 01-09-2014, 08:01 PM
  3. Replies: 1
    Last Post: 10-19-2012, 07:55 AM
  4. Count selected rows in sheet (and use as input parameter)
    By nalfin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-04-2009, 11:46 AM
  5. count the nos of cells after selecting parameter in autofilter
    By ss_bb_24 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-23-2009, 08:14 AM

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