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.

excelformulaspreadsheettutorial
11 min read • Last updated: 7/2/2025

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:

  • COUNTIFS supports 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 separate COUNTIFS calls 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 COUNTIFS is 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), SUMPRODUCT provides 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-COUNTIFS pattern is both performant and easy to audit.

Parameters and Inputs

Before writing any formula, confirm the following:

  1. 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.
  2. 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).
  3. upper_limit – The top of the acceptable band. Ensure that upper_limit ≥ lower_limit to avoid logical inversions.
  4. Optional: criteria in other columns – You can nest the core logic inside a larger COUNTIFS to add filters by region, product, or date, but always keep the out-of-range conditions separate with OR logic.
  5. Data preparation – Remove text strings, error values, or hidden non-print characters that could corrupt counts. Consider wrapping the range inside IFERROR filters or cleansing via Power Query if you suspect impurities.
  6. 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
  1. Enter the lower limit, 60, in [E2] and the upper limit, 80, in [F2].
  2. In [G2], type:
=COUNTIFS(B2:B11,"<"&E2) + COUNTIFS(B2:B11,">"&F2)
  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 VALUE or 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.

  1. Lower spec [H2] = 95, upper spec [I2] = 105.
  2. 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)
  1. The formula filters column A for “Line A” AND checks column B for the two OR criteria using separate COUNTIFS calls.
  2. 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.
  • SUMPRODUCT converts the resulting TRUE/FALSE arrays into 1/0 and sums them, producing a count per sheet.
  • The outer SUM aggregates 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

  1. Lock limit cells with absolute references ($B$2, $C$2) so you can copy formulas across reports without breaking criteria.
  2. Convert data ranges to Excel Tables; formulas automatically expand as new rows arrive and use friendly names like tblSales[Amount].
  3. Document logic with in-cell comments or adjacent labels (“Outliers = count below 60 or above 80”) to help new team members audit quickly.
  4. Use named ranges (e.g., LowerSpec, UpperSpec) to improve readability and facilitate workbook-wide changes from a single location.
  5. Test with small datasets first; once the formula returns expected results, scale to full ranges—this prevents chasing ghosts in huge sheets.
  6. 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

  1. 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 IF check.
  2. Using AND inside one COUNTIFS – Writing COUNTIFS(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.
  3. 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:

  • COUNTIFS supports 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 separate COUNTIFS calls 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 COUNTIFS is 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), SUMPRODUCT provides 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-COUNTIFS pattern is both performant and easy to audit.

Parameters and Inputs

Before writing any formula, confirm the following:

  1. 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.
  2. 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).
  3. upper_limit – The top of the acceptable band. Ensure that upper_limit ≥ lower_limit to avoid logical inversions.
  4. Optional: criteria in other columns – You can nest the core logic inside a larger COUNTIFS to add filters by region, product, or date, but always keep the out-of-range conditions separate with OR logic.
  5. Data preparation – Remove text strings, error values, or hidden non-print characters that could corrupt counts. Consider wrapping the range inside IFERROR filters or cleansing via Power Query if you suspect impurities.
  6. 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
  1. Enter the lower limit, 60, in [E2] and the upper limit, 80, in [F2].
  2. In [G2], type:

CODE_BLOCK_1

  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 VALUE or 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.

  1. Lower spec [H2] = 95, upper spec [I2] = 105.
  2. In dashboard cell [H5] labeled \"Line A out-of-spec\", enter:

CODE_BLOCK_2

  1. The formula filters column A for “Line A” AND checks column B for the two OR criteria using separate COUNTIFS calls.
  2. 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.
  • SUMPRODUCT converts the resulting TRUE/FALSE arrays into 1/0 and sums them, producing a count per sheet.
  • The outer SUM aggregates 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

  1. Lock limit cells with absolute references ($B$2, $C$2) so you can copy formulas across reports without breaking criteria.
  2. Convert data ranges to Excel Tables; formulas automatically expand as new rows arrive and use friendly names like tblSales[Amount].
  3. Document logic with in-cell comments or adjacent labels (“Outliers = count below 60 or above 80”) to help new team members audit quickly.
  4. Use named ranges (e.g., LowerSpec, UpperSpec) to improve readability and facilitate workbook-wide changes from a single location.
  5. Test with small datasets first; once the formula returns expected results, scale to full ranges—this prevents chasing ghosts in huge sheets.
  6. 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

  1. 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 IF check.
  2. Using AND inside one COUNTIFS – Writing COUNTIFS(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.
  3. Forgetting to lock references – Copying a formula downward without anchors shifts the limit cells, producing wildly incorrect counts.
  4. Including text values inadvertently – A hidden apostrophe or imported string \"100\" will be ignored. Use VALUE or NUMBERVALUE to coerce, or validate with ISTEXT.
  5. Hard-coding numbers – Embedding 95 or 105 in the formula instead of referencing cells hides business logic and complicates future specification changes.

Alternative Methods

MethodFormula PatternProsConsBest For
Dual COUNTIFS (recommended)COUNTIFS(range,"<"&low)+COUNTIFS(range,">"&high)Simple, readable, no array entryTwo function calls, OR logic requires additionGeneral purpose, modern Excel
Dual COUNTIFCOUNTIF(range,"<"&low)+COUNTIF(range,">"&high)Works in Excel 2003 or earlierSingle-criteria only, no additional filtersLegacy compatibility
SUMPRODUCTSUMPRODUCT((range(low))+(range>high))Handles OR inside one call, supports additional criteria via multiplicationArray calculations may be slower on huge rangesCompatibility before 2007, complex conditions
PivotTable with FiltersUse “Outside Range” slicer filtersNo formulas, visual, interactiveRefresh required, manual setupAd-hoc analysis, presentation
Power QueryFilter Out-of-Range rows then Group ByRepeatable ETL, scalableRequires load to Data Model or sheet refreshLarge 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.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.