+ Reply to Thread
Results 1 to 9 of 9

assistance with max consecutive occurrences in a manipulable range, please

  1. #1
    Registered User
    Join Date
    08-07-2014
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    24

    assistance with max consecutive occurrences in a manipulable range, please

    Kind People,
    I need assistance with a complex formula (for me at least) to count the max consecutive occurrences a a letter in a range. The range in which to search however' should be manipulable - if possible.
    I attached a sample of the basic spreadsheet I am working on - where I point out where my problems lie.
    Your kind assistance will be appreciated - as always.
    Thank you kindly and regards.
    Bab
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,647

    Re: assistance with max consecutive occurrences in a manipulable range, please

    Try this modification of your array entered formula* in C15:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    *array entered formulas are activated by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,647

    Re: assistance with max consecutive occurrences in a manipulable range, please

    I think that I missed an important requirement, the count needs to fall within the range of dates specified. To accomplish that the following array entered formula, placed in B15 references two helper cells, which may be hidden for aesthetic purposes*:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The formulas to find the start and end of the period respectively are:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    *These formulas could be incorporated into the array entered formula in cell B15, however I feel that it is easier to understand how the overall solution works if you are able to see their results. Let us know if you have any questions.

  4. #4
    Registered User
    Join Date
    08-07-2014
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    24

    Re: assistance with max consecutive occurrences in a manipulable range, please

    JeteMc,
    Really appreciated, thanks.
    Your solution solved my problem. More so because it was made simple and clear.
    Regards.
    Bab

  5. #5
    Registered User
    Join Date
    08-07-2014
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    24

    Re: assistance with max consecutive occurrences in a manipulable range, please

    JeteMc,
    Sorry - back again:
    In your initial array above; =MAX(FREQUENCY(IF(B3:AGZ3="P",COLUMN(B2:AGZ2)),IF(B3:AGZ3<>"P",COLUMN(B2:AGZ2)))), the range "searched" is B3:AGZ3 or basically in row 3.
    When I use the more streamlined array; =MAX(FREQUENCY(IF(INDIRECT(B17&":"&B18)="P",COLUMN(INDIRECT(B17&":"&B18))),IF(INDIRECT(B17&":"&B18)<>"P",COLUMN(INDIRECT(B17&":"&B18))))), I naturally cannot see the range as in the above array, and have no idea how to change that to do a different range i.e. B4:AGZ4 or basically row 4.
    How do I do this or how do I edit inside that array?
    Thank you in advance.
    Regards.
    Bab

  6. #6
    Registered User
    Join Date
    08-07-2014
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    24

    Re: assistance with max consecutive occurrences in a manipulable range, please

    JeteMc,
    Sorry - back again:
    In your initial array above; =MAX(FREQUENCY(IF(B3:AGZ3="P",COLUMN(B2:AGZ2)),IF(B3:AGZ3<>"P",COLUMN(B2:AGZ2)))), the range "searched" is B3:AGZ3 or basically in row 3.
    When I use the more streamlined array; =MAX(FREQUENCY(IF(INDIRECT(B17&":"&B18)="P",COLUMN(INDIRECT(B17&":"&B18))),IF(INDIRECT(B17&":"&B18)<>"P",COLUMN(INDIRECT(B17&":"&B18))))), I naturally cannot see the range as in the above array, and have no idea how to change that to do a different range i.e. B4:AGZ4 or basically row 4.
    How do I do this or how do I edit inside that array?
    Thank you in advance.
    Regards.
    Bab

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,647

    Re: assistance with max consecutive occurrences in a manipulable range, please

    The change is made with the helper cells as in changing 3 to 4. I modified the helper cell formulas so that they find the letters A and B in column A, instead of having the row number 3 and 4 hard coded into the formula.
    The formula for B17 now reads:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The formula for B18 now reads:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The formulas can be copied/pasted into K17:K18. Similarly the formula from B15 can be copied/pasted into K15 as is shown in the attached file.
    Let us know if you have any questions.

  8. #8
    Registered User
    Join Date
    08-07-2014
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    24

    Re: assistance with max consecutive occurrences in a manipulable range, please

    Works perfectly, thanks.

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,647

    Re: assistance with max consecutive occurrences in a manipulable range, please

    You're Welcome. Thank you for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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 occurrences in a column
    By Sartorialism in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-01-2016, 06:44 PM
  2. [SOLVED] Help with formula to find consecutive occurrences/duration of a situation(stockout)
    By aaronmaize3 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-07-2015, 02:39 PM
  3. [SOLVED] Count Consecutive Occurrences
    By dlow in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-17-2014, 12:50 AM
  4. Count consecutive number of negative occurrences >=3
    By nbiggss in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-02-2012, 02:14 PM
  5. Count the number of consecutive occurrences
    By timmycl_7 in forum Excel General
    Replies: 12
    Last Post: 05-03-2012, 02:04 PM
  6. Find 4 consecutive occurrences
    By swatsp0p in forum Excel General
    Replies: 8
    Last Post: 03-27-2010, 01:55 PM
  7. counting the most consecutive occurrences
    By Reignman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-12-2005, 05:56 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