How to Count Runs of Three Consecutive Values Above a Criterion in Excel
Question details
The user needs to count the number of times a sequence of at least three consecutive values in a row (e.g., B1:Z1) exceeds a specified criterion (e.g., A1).

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Analyzing a row of data to identify and count specific streaks or runs of data points that meet or exceed a target threshold.
- Observed behavior
- Requires a formula combination that can accurately group consecutive cells meeting the criteria and sum the occurrences of runs that are three or more cells long.
Ensure your data is organized in a contiguous row without interfering blank cells, and note that older versions of spreadsheet software may require confirming array formulas with a specific keyboard shortcut.
Use the FREQUENCY and IF Array Formula
The most robust way to count consecutive occurrences above a threshold is by combining the FREQUENCY, IF, and SUM functions in an array formula.
This formula uses the IF function to identify column numbers where the condition is met and where it is not. The FREQUENCY function then groups these true instances based on the false instances (the interruptions in the run), calculating the length of each consecutive streak.
Click on the cell where you want the final count of consecutive runs to appear.
Type the following formula into the formula bar: =SUM(--(FREQUENCY(IF(B1:Z1>A1,COLUMN(B1:Z1)),IF(B1:Z1<=A1,COLUMN(B1:Z1)))>=3))
If you are using Microsoft 365 or modern versions of WPS Spreadsheet, simply press Enter. For older versions of Excel, you must press Ctrl+Shift+Enter to evaluate it properly as an array formula (curly braces {} will appear around it).
Click and drag the fill handle at the bottom-right corner of the cell downwards to apply this calculation to additional rows of data. The row references will adjust automatically.

Count Consecutive Values Effortlessly with WPS Spreadsheet
WPS Spreadsheet fully supports complex array formulas like FREQUENCY and IF, allowing you to seamlessly analyze consecutive runs and data trends just as you would in Microsoft Excel.
- 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your data sequences.
- 2. Select an empty cell: Click on the cell at the end of your data row where you want to display the run count.
- 3. Enter the FREQUENCY formula: Paste the formula =SUM(--(FREQUENCY(IF(B1:Z1>A1,COLUMN(B1:Z1)),IF(B1:Z1<=A1,COLUMN(B1:Z1)))>=3)) into the formula bar.
- 4. Press Enter: Hit Enter to instantly calculate the total number of runs that meet your criterion.

Frequently Asked Questions
How do I change the formula to count runs of 5 consecutive values instead of 3?
To look for a different run length, simply change the number at the very end of the formula. Replace '>=3' with '>=5' to count streaks of five or more consecutive values.
Why does my formula return a #VALUE! error?
This usually happens in older spreadsheet software if you just press Enter. You must press Ctrl+Shift+Enter to evaluate it as an array formula. When done correctly, curly braces {} will automatically enclose the formula.
Can I use this formula for data in a column instead of a row?
Yes. If your data is organized vertically (e.g., A2:A50), you need to replace the COLUMN() function with the ROW() function in the formula, and update the ranges accordingly.




