+ Reply to Thread
Results 1 to 7 of 7

Counting Consecutive Values left to right?

  1. #1
    Registered User
    Join Date
    05-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    8

    Counting Consecutive Values left to right?

    Greetings! I have been trying to adapt a couple of the posts I've seen on this topic but they seem to refer to counting in rows and I'm having trouble translating that to columns.

    I have a simple situation. I have 1s or 0s in columns from left to right. I only want to count the first occurrence of consecutive "1"s and only if the series starts with "1" in the left most column. (I am trying to calculate consecutive years of giving and the columns are FY14, FY13, FY12, etc. Only people who gave in FY14 would count.)

    Example:

    Row 2: 11101010
    Row 3: 11001011
    Row 4: 00100110

    I would like Row 2 to count "3", Row 3 to count "2" and Row 4 to count "0".

    Thank you!
    - Anthony

  2. #2
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Counting Consecutive Values left to right?

    If your data is complete (i.e., no blanks), then try:

    Please Login or Register  to view this content.
    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  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 Values left to right?

    Try this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    -----
    -----
    -----
    -----
    -----
    -----
    -----
    -----
    -----
    -----
    2
    1
    1
    1
    0
    1
    0
    1
    0
    3
    3
    1
    1
    0
    0
    1
    0
    1
    1
    2
    4
    0
    0
    1
    0
    0
    1
    1
    0
    0
    5
    1
    1
    1
    1
    1
    1
    1
    1
    8
    6
    0
    0
    0
    0
    0
    0
    0
    0
    0


    This formula entered in J2 and copied down:

    =IF(A2=1,IF(COUNTIF(A2:H2,0),MATCH(0,A2:H2,0)-1,SUM(A2:H2)),0)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    03-06-2014
    Location
    HCM
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: Counting Consecutive Values left to right?

    Hi all,

    Please help me to count "0" consecutive value instead 1 of value
    Ex:
    1 0 0 0 1 = 0
    0 0 1 0 1 = 2
    0 0 0 0 1 = 4
    Thanks

  5. #5
    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 Values left to right?

    We would like to help you but the forum owner prefers that you start your own thread rather than posting your question in someone else's thread (even though it might be related).
    Last edited by Tony Valko; 12-13-2016 at 11:07 AM.

  6. #6
    Registered User
    Join Date
    03-06-2014
    Location
    HCM
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: Counting Consecutive Values left to right?

    Quote Originally Posted by Tony Valko View Post
    We would like to help you but the forum owner prefers that you start your own thread rather than posting your question is someone else's thread (even though it might be related).
    Dear Tony,

    I think it is the same, I just replace 1 by 0. But I can't write a right fomular for this requestion. Please help me. Thanks

  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: Counting Consecutive Values left to right?


+ 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. [SOLVED] Counting consecutive values less than X
    By stellards20 in forum Excel General
    Replies: 3
    Last Post: 06-18-2014, 12:08 AM
  2. Counting same values in consecutive columns
    By santhoosan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-11-2013, 03:48 AM
  3. [SOLVED] Counting Consecutive Values
    By khauskins in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-24-2012, 11:37 AM
  4. Counting consecutive values
    By Elijah in forum Excel General
    Replies: 7
    Last Post: 04-23-2010, 05:13 PM
  5. Counting consecutive non-zero values
    By RichH6109 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-26-2007, 07:21 PM

Tags for this Thread

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