+ Reply to Thread
Results 1 to 9 of 9

Counting consecutive listed names

  1. #1
    Registered User
    Join Date
    03-18-2016
    Location
    New Zealand
    MS-Off Ver
    2007
    Posts
    29

    Counting consecutive listed names

    Hi everyone.

    I'm trying to count the number to times a name appears in a list under a certain heading. However is needs to be consecutive. So if someone appears under 1 heading 3 months in a row then the number 3 appears beside the name. If the name appears under one heading for just the 1st and 3rd month then a 1 appears beside the name. Does anyone know a formula which will do this for me?

    I've attached a document to make it more clear.

    I appreciate any help
    Thanks
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    04-07-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Counting consecutive listed names

    Hi

    Please find below the formulas you can use for

    M Column: =IF(COUNTIF($C$4:$C$13,L3)+COUNTIF($E$4:$E$13,L3)+COUNTIF($G$4:$G$13,L3)=2,1,COUNTIF($C$4:$C$13,L3)+COUNTIF($E$4:$E$13,L3)+COUNTIF($G$4:$G$13,L3))

    N Column: =IF(COUNTIF($D$4:$D$13,N3)+COUNTIF($F$4:$F$13,N3)+COUNTIF($H$4:$H$13,N3)=2,1,COUNTIF($D$4:$D$13,N3)+COUNTIF($F$4:$F$13,N3)+COUNTIF($H$4:$H$13,N3))

    Hope this helps.

    Thanks & Regards,
    Vidhya

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

    Re: Counting consecutive listed names

    These formulas are complex and if you need to do this over a year period the formulas will be quite long.

    Data Range
    L
    M
    N
    O
    2
    Coach
    Celebrate
    3
    Joe
    1
    Kylee
    1
    4
    Jess
    3
    Avril
    1
    5
    Tim
    3
    Rex
    1
    6
    Rita
    2
    Emily
    1
    7
    Matt
    1
    Jeff
    3
    8
    Khan
    1
    Vita
    3
    9
    Chris
    1
    Rob
    2
    10
    Steve
    3
    Bex
    2
    11
    Tom
    3
    Rachel
    2
    12
    Steph
    3
    Pam
    2
    13
    ------
    ------
    ------
    ------


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

    =MAX(FREQUENCY(IF(COUNTIF(INDIRECT({"C4:C13","E4:E13","G4:G13"}),L3)=1,COLUMN(A:C)),IF(COUNTIF(INDIRECT({"C4:C13","E4:E13","G4:G13"}),L3)<>1,COLUMN(A:C))))

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

    =MAX(FREQUENCY(IF(COUNTIF(INDIRECT({"D4:D13","F4:F13","H4:H13"}),N3)=1,COLUMN(A:C)),IF(COUNTIF(INDIRECT({"D4:D13","F4:F13","H4:H13"}),N3)<>1,COLUMN(A:C))))

    ** 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.

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

    Re: Counting consecutive listed names

    Quote Originally Posted by vidhyakrr View Post

    M Column: =IF(COUNTIF($C$4:$C$13,L3)+COUNTIF($E$4:$E$13,L3)+COUNTIF($G$4:$G$13,L3)=2,1,COUNTIF($C$4:$C$13,L3)+COUNTIF($E$4:$E$13,L3)+COUNTIF($G$4:$G$13,L3))

    N Column: =IF(COUNTIF($D$4:$D$13,N3)+COUNTIF($F$4:$F$13,N3)+COUNTIF($H$4:$H$13,N3)=2,1,COUNTIF($D$4:$D$13,N3)+COUNTIF($F$4:$F$13,N3)+COUNTIF($H$4:$H$13,N3))
    Where the counts should be 2 your formulas are returning 1.

  5. #5
    Registered User
    Join Date
    04-07-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    34

    Re: Counting consecutive listed names

    Quote Originally Posted by Tony Valko View Post
    Where the counts should be 2 your formulas are returning 1.
    Yes, that's the original expectation of Allen

    Allen, Please correct me if I am wrong.

  6. #6
    Registered User
    Join Date
    03-18-2016
    Location
    New Zealand
    MS-Off Ver
    2007
    Posts
    29

    Re: Counting consecutive listed names

    It worked, thanks very much. As months go on it will get longer and longer so thanks for the array version.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Counting consecutive listed names

    Another way.

    For coaches in M3 array enter this formula (Ctrl + Shift + Enter) and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    For celebrates in O3 array enter this and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    L
    M
    N
    O
    2
    Coach
    Celebrate
    3
    Joe
    1
    Kylee
    1
    4
    Jess
    3
    Avril
    1
    5
    Tim
    3
    Rex
    1
    6
    Rita
    2
    Emily
    1
    7
    Matt
    1
    Jeff
    3
    8
    Khan
    1
    Vita
    3
    9
    Chris
    1
    Rob
    2
    10
    Steve
    3
    Bex
    2
    11
    Tom
    3
    Rachel
    2
    12
    Steph
    3
    Pam
    2
    Dave

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

    Re: Counting consecutive listed names

    If you could change the layout such that each category is in its own table:

    Data Range
    A
    B
    C
    D
    1
    Coach
    February
    March
    April
    2
    Steve
    Steve
    Joe
    3
    Tom
    Tom
    Jess
    4
    Steph
    Steph
    Tim
    5
    Joe
    Emily
    Rita
    6
    Jess
    Jess
    Matt
    7
    Tim
    Tim
    Khan
    8
    Rob
    Rita
    Chris
    9
    Bex
    Kylee
    Steve
    10
    Rachel
    Avril
    Tom
    11
    Pam
    Rex
    Steph
    12
    13
    Celebrate
    Matt
    Matt
    Kylee
    14
    Khan
    Khan
    Avril
    15
    Chris
    Chris
    Rex
    16
    Emily
    Joe
    Emily
    17
    Jeff
    Jeff
    Jeff
    18
    Vita
    Vita
    Vita
    19
    Rita
    Rob
    Rob
    20
    Kylee
    Bex
    Bex
    21
    Avril
    Rachel
    Rachel
    22
    Rex
    Pam
    Pam


    Then the formula could be made more dynamic.

    Data Range
    G
    H
    I
    J
    1
    Coach
    Celebrate
    2
    Joe
    1
    Kylee
    1
    3
    Jess
    3
    Avril
    1
    4
    Tim
    3
    Rex
    1
    5
    Rita
    2
    Emily
    1
    6
    Matt
    1
    Jeff
    3
    7
    Khan
    1
    Vita
    3
    8
    Chris
    1
    Rob
    2
    9
    Steve
    3
    Bex
    2
    10
    Tom
    3
    Rachel
    2
    11
    Steph
    3
    Pam
    2
    12
    ------
    ------


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

    =MAX(FREQUENCY(IF(COUNTIF(OFFSET(B$2:B$11,,COLUMN(B$2:D$11)-COLUMN(B$2)),G2)=1,COLUMN(A:C)),IF(COUNTIF(OFFSET(B$2:B$11,,COLUMN(B$2:D$11)-COLUMN(B$2)),G2)<>1,COLUMN(A:C))))

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

    =MAX(FREQUENCY(IF(COUNTIF(OFFSET(B$13:B$22,,COLUMN(B$13:D$22)-COLUMN(B$13)),I2)=1,COLUMN(A:C)),IF(COUNTIF(OFFSET(B$13:B$22,,COLUMN(B$13:D$22)-COLUMN(B$13)),I2)<>1,COLUMN(A:C))))

    ** 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.

  9. #9
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,913

    Re: Counting consecutive listed names

    M3=
    Please Login or Register  to view this content.
    Try this array (Shift+Ctrl+Enter) formula and copy towards down
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

+ 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. Extract files from a folder using the names listed in a excel
    By firdausvariava in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2012, 08:34 AM
  2. Replies: 7
    Last Post: 04-23-2012, 02:27 PM
  3. Help with Counting Number of Dates Listed for Month
    By Ben75 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2011, 09:21 PM
  4. Writing outcomes and then names listed below
    By parachutistbynight in forum Excel General
    Replies: 6
    Last Post: 08-02-2009, 08:53 PM
  5. [SOLVED] How to create menu for listed names?
    By Eric in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-20-2006, 07:35 PM
  6. [SOLVED] [SOLVED] How to create menu for listed names?
    By Eric in forum Excel General
    Replies: 8
    Last Post: 04-20-2006, 02:40 AM
  7. [SOLVED] Count If-e store names listed.
    By Jim in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-25-2005, 11:05 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