How to Count Cells Not Between Two Numbers in Excel
Learn multiple Excel methods to count cells not between two numbers with step-by-step examples and practical applications.
How to Count Cells Not Between Two Numbers in Excel
Why This Task Matters in Excel
In almost every data-driven role—finance, sales, manufacturing, quality control, HR, healthcare analytics, academic research—you frequently need to flag or quantify values that fall outside an acceptable band. A sales manager may want to know how many weekly transactions are below the minimum commission threshold or above a regulatory ceiling. A quality engineer tracks product weights that deviate from specification limits. Human-resources analysts may examine salaries that sit outside a midpoint compensation range to identify outliers for pay-equity reviews. In each scenario, “not between two numbers” means anything smaller than the lower limit or larger than the upper limit, and the count often drives decisions such as corrective actions, escalation, or re-budgeting.
Excel excels (pun intended) at this kind of analysis because its grid layout mirrors the tabular data that organizations already use. With built-in functions that work on entire ranges, you avoid manual tallies and achieve immediate repeatable insight. Formulas such as COUNTIFS, COUNTIF, and SUMPRODUCT can calculate these outside-range counts in a single cell, making dashboards easier to maintain and update. If you skip learning this task, you risk resorting to cumbersome filtering, copying, or visually scanning rows—activities that waste time and introduce human error. Moreover, understanding how to evaluate “not between” conditions strengthens your overall logical-thinking skills in Excel, a foundation for advanced analytics such as conditional formatting, automated data validations, or Power Query transformations. By the end of this tutorial, you will not only master the core formulas but also grasp when to apply each alternative, how to troubleshoot unusual datasets, and where this knowledge integrates with broader workflows such as KPI scorecards or statistical process control charts.
Best Excel Approach
For most everyday scenarios, the combination of two COUNTIFS criteria inside a single COUNTIFS call is the fastest, clearest, and most maintainable way to count values that are not between two numbers.
=COUNTIFS(range,"<"&lower_limit) + COUNTIFS(range,">"&upper_limit)
Why this works:
COUNTIFSsupports multiple criteria but treats each set with an implicit AND logic. Because we need an OR logic (either below the low limit or above the high limit), we use two separateCOUNTIFScalls and add their results together.- Concatenating the comparison operator with the limit (e.g., \"<\"&lower_limit) keeps the limit dynamic and cell-referenced rather than hard-coded, simplifying maintenance.
- The formula is transparent to colleagues because
COUNTIFSis ubiquitous in modern Excel and the OR logic is apparent through the plus sign.
When might you reach for an alternative?
- If you must remain compatible with very old Excel versions that lack
COUNTIFS(pre-Excel 2007),SUMPRODUCTprovides a workaround. - If performance is critical on colossal ranges (hundreds of thousands of rows) and your workbook already employs structured references, Power Query or PivotTables might be better.
However, for nearly all current, worksheet-based workflows, the dual-COUNTIFSpattern is both performant and easy to audit.
Parameters and Inputs
Before writing any formula, confirm the following:
- range – The contiguous list of numeric cells you want to evaluate, such as [B2:B101]. Data type must be numeric; blank cells are ignored by all counting methods shown here.
- lower_limit – A single cell or literal number representing the bottom of the acceptable band. Format should match the numeric type of the range (date limits must be valid Excel dates).
- upper_limit – The top of the acceptable band. Ensure that upper_limit ≥ lower_limit to avoid logical inversions.
- Optional: criteria in other columns – You can nest the core logic inside a larger
COUNTIFSto add filters by region, product, or date, but always keep the out-of-range conditions separate with OR logic. - Data preparation – Remove text strings, error values, or hidden non-print characters that could corrupt counts. Consider wrapping the range inside
IFERRORfilters or cleansing via Power Query if you suspect impurities. - Edge cases – Decide whether the limits themselves count as “not between.” In most business rules, “between two numbers” implies inclusive, so values equal to either limit are inside the band and should not be counted here. If your policy differs, adjust the comparison operators.
Step-by-Step Examples
Example 1: Basic Scenario
Imagine a small test dataset of student quiz scores in [B2:B11]. Passing requires scores between 60 and 80 inclusive. You need to count how many students scored outside that safe band.
Sample data:
- [B2] 58
- [B3] 67
- [B4] 92
- [B5] 73
- [B6] 45
- [B7] 80
- [B8] 60
- [B9] 77
- [B10] 54
- [B11] 81
- Enter the lower limit, 60, in [E2] and the upper limit, 80, in [F2].
- In [G2], type:
=COUNTIFS(B2:B11,"<"&E2) + COUNTIFS(B2:B11,">"&F2)
- Press Enter. The formula returns 4 because scores 58, 45, 54 (below 60) and 92, 81 (above 80) total five, but 81 is above 80; we actually have five outliers. Let’s verify: 58, 92, 45, 54, 81. That indeed equals 5. If you receive an unexpected number, double-check the equality logic—values equal to 60 or 80 are not counted because of the \"<\" and \">\" operators.
Troubleshooting tips:
- If a score shows as text (left-aligned by default), Excel won’t include it. Convert with
VALUEor text-to-columns. - If a blank cell should also be treated as failing, append
+COUNTBLANK(B2:B11)to the formula.
Example 2: Real-World Application
A manufacturing company logs finished part diameters in microns across thousands of rows. Specifications: 95 µm to 105 µm inclusive. Management wants a weekly dashboard highlighting total parts outside spec per production line.
Data structure:
- Column A – Production Line ID
- Column B – Diameter (µm)
- Column C – TimeStamp
Goal: Count out-of-spec parts for Line A.
- Lower spec [H2] = 95, upper spec [I2] = 105.
- In dashboard cell [H5] labeled \"Line A out-of-spec\", enter:
=COUNTIFS(A:A,"Line A",B:B,"<"&$H$2) + COUNTIFS(A:A,"Line A",B:B,">"&$I$2)
- The formula filters column A for “Line A” AND checks column B for the two OR criteria using separate
COUNTIFScalls. - Repeat for other lines by changing the \"Line A\" criteria or by referencing a cell containing the line label, enabling easy copy-down across a summary table.
Why this approach excels:
- You preserve calculation speed because the criteria remain vectorized across entire columns, avoiding array entry.
- The dashboard updates automatically with new daily rows—no need to adjust the range reference thanks to using full columns A:A and B:B.
Performance considerations:
- Full-column references on very large workbooks (hundreds of thousands of rows) may slow recalculation. Limit to an Excel Table structured reference such as
tblParts[Diameter]for efficiency and readability. - Use manual calculation mode when importing massive CSVs to prevent interim recalcs.
Integration: Pair the count with conditional formatting to color the KPI red when the value exceeds a threshold, or chart the daily out-of-spec rate over time by dividing the count by total parts per day.
Example 3: Advanced Technique
Suppose you are analyzing financial transaction amounts across multiple sheets—one for each fiscal quarter. You need a single formula that tallies transactions not between 5,000 and 25,000 in any quarter, but you also want to ignore refunds (negative amounts) altogether.
Assumptions:
- Four quarterly sheets named Q1, Q2, Q3, Q4.
- Transactions live in [B2:B20000] on each sheet.
- In your summary sheet, cell [B2] stores the lower limit 5000, [C2] stores the upper limit 25000.
Instead of consolidating data into one sheet, use SUMPRODUCT inside SUM across 3-D references:
=SUM(
SUMPRODUCT((Q1!B2:B20000>=0)*((Q1!B2:B20000<$B$2)+(Q1!B2:B20000>$C$2))),
SUMPRODUCT((Q2!B2:B20000>=0)*((Q2!B2:B20000<$B$2)+(Q2!B2:B20000>$C$2))),
SUMPRODUCT((Q3!B2:B20000>=0)*((Q3!B2:B20000<$B$2)+(Q3!B2:B20000>$C$2))),
SUMPRODUCT((Q4!B2:B20000>=0)*((Q4!B2:B20000<$B$2)+(Q4!B2:B20000>$C$2)))
)
Explanation:
(Q1!B2:B20000 ≥ 0)screens out refunds.- The plus sign inside the second parenthesis implements OR logic between below-limit and above-limit checks.
SUMPRODUCTconverts the resulting TRUE/FALSE arrays into 1/0 and sums them, producing a count per sheet.- The outer
SUMaggregates all quarters.
Edge-case management: To include future sheets automatically, wrap the logic inside a 3D range like SUMPRODUCT(('Q1:Q4'!B2:B20000 ≥ 0)*...), but remember that structured 3-D references work only in certain formula constructs; SUMPRODUCT supports them in modern Excel.
Professional tip: If you have access to Dynamic Arrays (Office 365), you can spill all sheet names and feed them into LET and BYROW for a cleaner, scalable solution.
Tips and Best Practices
- Lock limit cells with absolute references (
$B$2,$C$2) so you can copy formulas across reports without breaking criteria. - Convert data ranges to Excel Tables; formulas automatically expand as new rows arrive and use friendly names like
tblSales[Amount]. - Document logic with in-cell comments or adjacent labels (“Outliers = count below 60 or above 80”) to help new team members audit quickly.
- Use named ranges (e.g.,
LowerSpec,UpperSpec) to improve readability and facilitate workbook-wide changes from a single location. - Test with small datasets first; once the formula returns expected results, scale to full ranges—this prevents chasing ghosts in huge sheets.
- Benchmark large workbooks: Measure recalc time before and after switching from full-column references to Table ranges or Power Pivot measures.
Common Mistakes to Avoid
- Reversing limits – If upper limit is typed lower than the lower limit, no number can be between them, so every value returns as outside spec. Always validate that upper ≥ lower through a simple
IFcheck. - Using AND inside one
COUNTIFS– WritingCOUNTIFS(range,"<"&low," >"&high)counts nothing because a value cannot be simultaneously less than low and greater than high. Remember OR logic requires two separate counts. - Forgetting to lock references – Copying a formula downward without `
How to Count Cells Not Between Two Numbers in Excel
Why This Task Matters in Excel
In almost every data-driven role—finance, sales, manufacturing, quality control, HR, healthcare analytics, academic research—you frequently need to flag or quantify values that fall outside an acceptable band. A sales manager may want to know how many weekly transactions are below the minimum commission threshold or above a regulatory ceiling. A quality engineer tracks product weights that deviate from specification limits. Human-resources analysts may examine salaries that sit outside a midpoint compensation range to identify outliers for pay-equity reviews. In each scenario, “not between two numbers” means anything smaller than the lower limit or larger than the upper limit, and the count often drives decisions such as corrective actions, escalation, or re-budgeting.
Excel excels (pun intended) at this kind of analysis because its grid layout mirrors the tabular data that organizations already use. With built-in functions that work on entire ranges, you avoid manual tallies and achieve immediate repeatable insight. Formulas such as COUNTIFS, COUNTIF, and SUMPRODUCT can calculate these outside-range counts in a single cell, making dashboards easier to maintain and update. If you skip learning this task, you risk resorting to cumbersome filtering, copying, or visually scanning rows—activities that waste time and introduce human error. Moreover, understanding how to evaluate “not between” conditions strengthens your overall logical-thinking skills in Excel, a foundation for advanced analytics such as conditional formatting, automated data validations, or Power Query transformations. By the end of this tutorial, you will not only master the core formulas but also grasp when to apply each alternative, how to troubleshoot unusual datasets, and where this knowledge integrates with broader workflows such as KPI scorecards or statistical process control charts.
Best Excel Approach
For most everyday scenarios, the combination of two COUNTIFS criteria inside a single COUNTIFS call is the fastest, clearest, and most maintainable way to count values that are not between two numbers.
CODE_BLOCK_0
Why this works:
COUNTIFSsupports multiple criteria but treats each set with an implicit AND logic. Because we need an OR logic (either below the low limit or above the high limit), we use two separateCOUNTIFScalls and add their results together.- Concatenating the comparison operator with the limit (e.g., \"<\"&lower_limit) keeps the limit dynamic and cell-referenced rather than hard-coded, simplifying maintenance.
- The formula is transparent to colleagues because
COUNTIFSis ubiquitous in modern Excel and the OR logic is apparent through the plus sign.
When might you reach for an alternative?
- If you must remain compatible with very old Excel versions that lack
COUNTIFS(pre-Excel 2007),SUMPRODUCTprovides a workaround. - If performance is critical on colossal ranges (hundreds of thousands of rows) and your workbook already employs structured references, Power Query or PivotTables might be better.
However, for nearly all current, worksheet-based workflows, the dual-COUNTIFSpattern is both performant and easy to audit.
Parameters and Inputs
Before writing any formula, confirm the following:
- range – The contiguous list of numeric cells you want to evaluate, such as [B2:B101]. Data type must be numeric; blank cells are ignored by all counting methods shown here.
- lower_limit – A single cell or literal number representing the bottom of the acceptable band. Format should match the numeric type of the range (date limits must be valid Excel dates).
- upper_limit – The top of the acceptable band. Ensure that upper_limit ≥ lower_limit to avoid logical inversions.
- Optional: criteria in other columns – You can nest the core logic inside a larger
COUNTIFSto add filters by region, product, or date, but always keep the out-of-range conditions separate with OR logic. - Data preparation – Remove text strings, error values, or hidden non-print characters that could corrupt counts. Consider wrapping the range inside
IFERRORfilters or cleansing via Power Query if you suspect impurities. - Edge cases – Decide whether the limits themselves count as “not between.” In most business rules, “between two numbers” implies inclusive, so values equal to either limit are inside the band and should not be counted here. If your policy differs, adjust the comparison operators.
Step-by-Step Examples
Example 1: Basic Scenario
Imagine a small test dataset of student quiz scores in [B2:B11]. Passing requires scores between 60 and 80 inclusive. You need to count how many students scored outside that safe band.
Sample data:
- [B2] 58
- [B3] 67
- [B4] 92
- [B5] 73
- [B6] 45
- [B7] 80
- [B8] 60
- [B9] 77
- [B10] 54
- [B11] 81
- Enter the lower limit, 60, in [E2] and the upper limit, 80, in [F2].
- In [G2], type:
CODE_BLOCK_1
- Press Enter. The formula returns 4 because scores 58, 45, 54 (below 60) and 92, 81 (above 80) total five, but 81 is above 80; we actually have five outliers. Let’s verify: 58, 92, 45, 54, 81. That indeed equals 5. If you receive an unexpected number, double-check the equality logic—values equal to 60 or 80 are not counted because of the \"<\" and \">\" operators.
Troubleshooting tips:
- If a score shows as text (left-aligned by default), Excel won’t include it. Convert with
VALUEor text-to-columns. - If a blank cell should also be treated as failing, append
+COUNTBLANK(B2:B11)to the formula.
Example 2: Real-World Application
A manufacturing company logs finished part diameters in microns across thousands of rows. Specifications: 95 µm to 105 µm inclusive. Management wants a weekly dashboard highlighting total parts outside spec per production line.
Data structure:
- Column A – Production Line ID
- Column B – Diameter (µm)
- Column C – TimeStamp
Goal: Count out-of-spec parts for Line A.
- Lower spec [H2] = 95, upper spec [I2] = 105.
- In dashboard cell [H5] labeled \"Line A out-of-spec\", enter:
CODE_BLOCK_2
- The formula filters column A for “Line A” AND checks column B for the two OR criteria using separate
COUNTIFScalls. - Repeat for other lines by changing the \"Line A\" criteria or by referencing a cell containing the line label, enabling easy copy-down across a summary table.
Why this approach excels:
- You preserve calculation speed because the criteria remain vectorized across entire columns, avoiding array entry.
- The dashboard updates automatically with new daily rows—no need to adjust the range reference thanks to using full columns A:A and B:B.
Performance considerations:
- Full-column references on very large workbooks (hundreds of thousands of rows) may slow recalculation. Limit to an Excel Table structured reference such as
tblParts[Diameter]for efficiency and readability. - Use manual calculation mode when importing massive CSVs to prevent interim recalcs.
Integration: Pair the count with conditional formatting to color the KPI red when the value exceeds a threshold, or chart the daily out-of-spec rate over time by dividing the count by total parts per day.
Example 3: Advanced Technique
Suppose you are analyzing financial transaction amounts across multiple sheets—one for each fiscal quarter. You need a single formula that tallies transactions not between 5,000 and 25,000 in any quarter, but you also want to ignore refunds (negative amounts) altogether.
Assumptions:
- Four quarterly sheets named Q1, Q2, Q3, Q4.
- Transactions live in [B2:B20000] on each sheet.
- In your summary sheet, cell [B2] stores the lower limit 5000, [C2] stores the upper limit 25000.
Instead of consolidating data into one sheet, use SUMPRODUCT inside SUM across 3-D references:
CODE_BLOCK_3
Explanation:
(Q1!B2:B20000 ≥ 0)screens out refunds.- The plus sign inside the second parenthesis implements OR logic between below-limit and above-limit checks.
SUMPRODUCTconverts the resulting TRUE/FALSE arrays into 1/0 and sums them, producing a count per sheet.- The outer
SUMaggregates all quarters.
Edge-case management: To include future sheets automatically, wrap the logic inside a 3D range like SUMPRODUCT(('Q1:Q4'!B2:B20000 ≥ 0)*...), but remember that structured 3-D references work only in certain formula constructs; SUMPRODUCT supports them in modern Excel.
Professional tip: If you have access to Dynamic Arrays (Office 365), you can spill all sheet names and feed them into LET and BYROW for a cleaner, scalable solution.
Tips and Best Practices
- Lock limit cells with absolute references (
$B$2,$C$2) so you can copy formulas across reports without breaking criteria. - Convert data ranges to Excel Tables; formulas automatically expand as new rows arrive and use friendly names like
tblSales[Amount]. - Document logic with in-cell comments or adjacent labels (“Outliers = count below 60 or above 80”) to help new team members audit quickly.
- Use named ranges (e.g.,
LowerSpec,UpperSpec) to improve readability and facilitate workbook-wide changes from a single location. - Test with small datasets first; once the formula returns expected results, scale to full ranges—this prevents chasing ghosts in huge sheets.
- Benchmark large workbooks: Measure recalc time before and after switching from full-column references to Table ranges or Power Pivot measures.
Common Mistakes to Avoid
- Reversing limits – If upper limit is typed lower than the lower limit, no number can be between them, so every value returns as outside spec. Always validate that upper ≥ lower through a simple
IFcheck. - Using AND inside one
COUNTIFS– WritingCOUNTIFS(range,"<"&low," >"&high)counts nothing because a value cannot be simultaneously less than low and greater than high. Remember OR logic requires two separate counts. - Forgetting to lock references – Copying a formula downward without anchors shifts the limit cells, producing wildly incorrect counts.
- Including text values inadvertently – A hidden apostrophe or imported string \"100\" will be ignored. Use
VALUEorNUMBERVALUEto coerce, or validate withISTEXT. - Hard-coding numbers – Embedding 95 or 105 in the formula instead of referencing cells hides business logic and complicates future specification changes.
Alternative Methods
| Method | Formula Pattern | Pros | Cons | Best For |
|---|---|---|---|---|
Dual COUNTIFS (recommended) | COUNTIFS(range,"<"&low)+COUNTIFS(range,">"&high) | Simple, readable, no array entry | Two function calls, OR logic requires addition | General purpose, modern Excel |
Dual COUNTIF | COUNTIF(range,"<"&low)+COUNTIF(range,">"&high) | Works in Excel 2003 or earlier | Single-criteria only, no additional filters | Legacy compatibility |
SUMPRODUCT | SUMPRODUCT((range(low))+(range>high)) | Handles OR inside one call, supports additional criteria via multiplication | Array calculations may be slower on huge ranges | Compatibility before 2007, complex conditions |
| PivotTable with Filters | Use “Outside Range” slicer filters | No formulas, visual, interactive | Refresh required, manual setup | Ad-hoc analysis, presentation |
| Power Query | Filter Out-of-Range rows then Group By | Repeatable ETL, scalable | Requires load to Data Model or sheet refresh | Large datasets, automation pipelines |
When dealing with datasets exceeding one million rows, consider Power Pivot measures with DAX formulas such as CALCULATE(COUNTROWS(...), NOT(between)) for superior performance.
FAQ
When should I use this approach?
Use dual COUNTIFS whenever you need a quick, transparent cell formula to feed dashboards, conditional formatting, or validation alerts. It shines in operational spreadsheets reviewed by non-technical stakeholders.
Can this work across multiple sheets?
Yes. You can sum identical formulas adjusted for each sheet, employ 3-D references (e.g., 'Sheet1:Sheet4'!A1), or consolidate via Power Query. For Dynamic Arrays, combine sheet names with INDIRECT cautiously—note that INDIRECT is volatile and may slow recalculations.
What are the limitations?
COUNTIFS cannot implement OR logic inside one call, which is why we add two counts. It also ignores errors and text automatically; if those values matter, wrap with IFERROR or cleanse beforehand. Full-column references recalc slower on large data.
How do I handle errors?
First, remove or convert errors within the range using IFERROR(original_formula,0) or Power Query’s Replace Errors step. If errors signify missing numeric values you want counted as out-of-range, wrap an outer IF(ISERROR(cell),1,condition) inside SUMPRODUCT.
Does this work in older Excel versions?
Excel 2003 lacks COUNTIFS, so use dual COUNTIF or SUMPRODUCT. Starting Excel 2007 and continuing through Office 365, the tutorials’ formulas function unchanged.
What about performance with large datasets?
Limit range references to actual data (or Table columns), avoid volatile functions like INDIRECT, and consider turning on Manual Calculation while editing. For million-row tables, move logic to Power Pivot or Power Query where the columnar engine handles calculations more efficiently.
Conclusion
Counting cells that fall outside a specific numeric band is a deceptively common need that underpins quality control, financial oversight, and analytical outlier detection. Mastering the dual-COUNTIFS (or its alternatives) equips you to transform raw data into actionable metrics with a single, reliable cell formula. This skill dovetails with a broader Excel toolkit—conditional formatting, dashboards, data validation, and ETL pipelines—solidifying your credibility as a data professional. Practice with your own datasets, explore array-enabled variations in Office 365, and soon you’ll deploy these techniques instinctively as part of your everyday analytical workflow.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.