How to Count Current Consecutive Negative Values in Excel
Question details
The user needs a formula to count the current, ongoing period of consecutive negative values at the end of a dataset. The formula must stop counting when the most recent non-negative value is reached and should not use VBA macros.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Tracking recent runs of negative monthly values in a spreadsheet where existing formulas incorrectly return the maximum historical streak rather than the ongoing one.
- Observed behavior
- The existing array formula returns the longest historical run of negative values across the entire row, failing to isolate the current consecutive negative streak at the end of the timeline.
Ensure your data is arranged chronologically in a single row or column. Verify whether your software supports modern dynamic array functions (like XMATCH), as this determines which formula solution you should apply.
Use XMATCH to Count the Current Negative Run Backward
This solution leverages modern dynamic array functions to evaluate the dataset backwards, locating the most recent non-negative value and counting the negative streak after it.
By using functions like XMATCH combined with COLUMNS, you can search a row from the last entry to the first. This precisely identifies the cutoff point for your current negative streak without needing complex array calculations or macros.
Click on the cell at the end of your row where you want the current consecutive negative count to appear.
Assuming your chronological monthly data is located in the range G3:L3 (where L3 is the most recent month), you need to search for the last non-negative number. Type the following formula: =IF(L3>=0, "", COLUMNS(G3:L3) - IFERROR(XMATCH(TRUE, G3:L3>=0, 0, -1), 0))
Press Enter to execute the formula. The '-1' argument in XMATCH ensures it searches from the latest month backward. If the current month is positive, it returns a blank, exactly as required.

Use a Traditional FREQUENCY Array Formula
For older versions of Excel that do not support XMATCH, a combination of FREQUENCY and COLUMN functions can calculate the streak.
Seamlessly Calculate Data Streaks with WPS Spreadsheet
WPS Office offers a powerful, free alternative to Microsoft Office, fully supporting advanced array formulas, XMATCH, and dynamic data analysis. You can seamlessly track financial streaks and manage complex datasets with zero compatibility issues.
- 1. Download and Install: Get the free WPS Office suite from the official website and open WPS Spreadsheet.
- 2. Open Your Dataset: Open your existing .xlsx or .xls file containing the monthly data.
- 3. Apply the Formula: Select an empty cell and enter the XMATCH or FREQUENCY formula.
- 4. Calculate the Result: Press Enter (or Ctrl+Shift+Enter for older array formulas) to instantly see your consecutive negative run.

Frequently Asked Questions
Why does my formula return the longest historical streak instead of the current one?
Formulas utilizing the MAX and FREQUENCY combination typically evaluate the entire dataset to find the highest run of conditions met anywhere in the row. To get only the current ongoing streak, your formula must specifically evaluate data starting from the most recent entry backwards until it hits a non-negative number.
Do I need to use VBA macros to count consecutive values?
No. While VBA can easily loop backward through cells, you can achieve the exact same result without macros by using modern built-in functions like XMATCH with the search_mode set to -1 (search last to first).
How do I correctly enter an array formula in older spreadsheet versions?
In older software versions, array formulas must be confirmed by pressing Ctrl + Shift + Enter simultaneously instead of just Enter. This tells the application to evaluate the formula over an array of data, and it will automatically enclose the formula in curly brackets {}.




