+ Reply to Thread
Results 1 to 7 of 7

Count in a range, where identical adjacent cells count as one instance.

  1. #1
    Registered User
    Join Date
    08-28-2012
    Location
    glasgow
    MS-Off Ver
    excel 2003 / 07 / 10
    Posts
    3

    Count in a range, where identical adjacent cells count as one instance.

    Hi guys


    This will be my first question here, so sorry if I break any sort of etiquette. I have set up an attendence tracker that allows me to mark each employee with a status each day: Working, Sick, Half Day, Annual Leave and so on.

    I would like to count their periods of absence. I know how to use count, countif and countifs, but I can't figure out how to do this. Example:

    Sick Periods.xlsx

    Absent on monday, present tuesday, absent wednesday and thursday, present friday. This would be 2 periods of absence.

    Absent monday - friday. This would be 1 period of absence.

    I'm essentially trying to group identical adjacent cells so that they only get counted by my formula once. Is this possible?

    Any help would be much appreciated.

    Thanks,

    Robert
    Last edited by the-algebraist; 02-04-2013 at 07:20 PM.

  2. #2
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Count in a range, where identical adjacent cells count as one instance.

    It would be a good idea to post a sample workbook showing the format of your data, as well as an example of what your desired solution would look like.
    Please click the * icon below if I have helped.

  3. #3
    Registered User
    Join Date
    08-28-2012
    Location
    glasgow
    MS-Off Ver
    excel 2003 / 07 / 10
    Posts
    3

    Re: Count in a range, where identical adjacent cells count as one instance.

    That's me added the example book. Cheers

  4. #4
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Count in a range, where identical adjacent cells count as one instance.

    The following might be useful:
    HTML Code: 
    HTML Code: 
    Last edited by Melvinrobb; 02-04-2013 at 06:46 PM.

  5. #5
    Registered User
    Join Date
    08-28-2012
    Location
    glasgow
    MS-Off Ver
    excel 2003 / 07 / 10
    Posts
    3

    Re: Count in a range, where identical adjacent cells count as one instance.

    I have tried the count only nonconsecutive threat, but I can't seem to work out how to turn the example formula they've given into something that works for me. I've tried messing about with the ranges and conditions but I'm still not getting it.

  6. #6
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Count in a range, where identical adjacent cells count as one instance.

    It is beyond me unfortunately.

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

    Re: Count in a range, where identical adjacent cells count as one instance.

    This array formula** entered in I6 and copied down:

    =SUM(IF(FREQUENCY(IF(C6:G6="sick",COLUMN(C6:G6)),IF(C6:G6<>"sick",COLUMN(C6:G6))),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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