Results 1 to 4 of 4

Thread: counting consecutive values in an array

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    counting consecutive values in an array

    Hello Everyone,
    I need your help to count consecutive values in an array.
    If you look at the file attached - there is an example.

    1. a1:a38 - is the array and i would like to insert a formula that will be counting if there are more than 5 consecutive "ODD" occurences - the answer should be 8

    2. e1: e38 - is my second array - and there i would like to insert a formula that will be counting more than 5 occurances ODD-EVEN-ODD-EVEN or EVEN-ODD-EVEN-ODD - the answer should be 9

    Thanks!
    Attached Files Attached Files

  2. #2
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0
    if 2.) is difficult to be done i would appreciate suggestions for 1.)

  3. #3
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Hi

    For 1, this would work.

    =MAX(FREQUENCY(IF(A1:A38="ODD",ROW(A1:A38)),IF(A1: A38<>"ODD",ROW(A1:A38))))
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  4. #4
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Rep Power
    0
    Hi sko

    I'm having a problem understanding the true requirements of your second request. You say that you want the count of occurrences of the sequence of values "ODD/EVEN/ODD/EVEN" or "EVEN/ODD/EVEN/ODD".

    Your suggested answer of 9 implies that overlapping occurrences are fine.

    ie. the SEQUENCE "ODD/EVEN/ODD/EVEN/ODD" has two occurrences - the first is "ODD/EVEN/ODD/EVEN" and the second (which starts with the first EVEN) is
    "EVEN/ODD'EVEN/ODD"

    Using this as the basis for calculating, I come up with only 7 occurrences. The first is in cells E7:E10, and then there are sequences starting in E30, E31, E32, E33, E34 and E35. The sequences starting in E36, #37 and E38 are too short to qualify as true occurrences. It may be that you wanted consecutive sequences of more than 5 occurrences, in which case the singleton occurrence at E7 should be discarded giving only 6 (or 2 if you are actually counting the sequences of 5+).

    Can you please clarify exactly what you are trying to do - this will help finding a solution!

    Tony

Similar Threads

  1. Replies: 16
    Last Post: 04-19-2013, 08:20 PM
  2. Count consecutive value in a range using formula
    By LalitPandey87 in forum Excel Help
    Replies: 6
    Last Post: 11-12-2012, 05:23 PM
  3. Subtraction Of Series Of Cells' / Array Values
    By PcMax in forum Excel Help
    Replies: 6
    Last Post: 10-26-2012, 11:55 PM
  4. Custom Spin Button Based On Values Passed From Array
    By Preeti Verma in forum Excel Help
    Replies: 7
    Last Post: 05-22-2012, 07:23 PM
  5. Replies: 3
    Last Post: 04-08-2012, 09:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •