HomeGoogle DocsSpreadsheetTest Whether Results Fall Within Their Limit in Google Sheets

Test Whether Results Fall Within Their Limit in Google Sheets

It’s easy to check whether test results fall within their limits in Google Sheets. You can use either the ISBETWEEN function or comparison operators. This tutorial will walk you through both approaches.

In such logical tests, typically three arrays are involved:

  1. Actual results – the values to test.
  2. Lower limit – start of the acceptable range.
  3. Upper limit – end of the acceptable range.

For example, in a medical lab report, the Result column corresponds to the test results, while Range From and Range To columns represent the normal limits.

Similarly, in a job schedule, you might want to test whether actual start dates fall within scheduled start and end dates.

Example Dataset

Example of ISBETWEEN formula checking test results within limits

Here, we want to check if each Result falls between its corresponding Range From and Range To.

Solution 1: Using ISBETWEEN

Place this formula in cell F2:

=ISBETWEEN(B2:B5, C2:C5, D2:D5)
  • B2:B5 → values to compare.
  • C2:C5 → lower limits.
  • D2:D5 → upper limits.

This will return TRUE for values within range and FALSE otherwise.

To handle dynamic ranges with possible blank rows, use:

=ARRAYFORMULA(IF(LEN(B2:B), ISBETWEEN(B2:B, C2:C, D2:D), ))

This ensures the formula only evaluates rows with actual data.

Solution 2: Using Comparison Operators

You can achieve the same result using comparison operators:

=ARRAYFORMULA(IF((B2:B5>=C2:C5)*(B2:B5<=D2:D5), TRUE, FALSE))

Or, for dynamic ranges:

=ARRAYFORMULA(IF(LEN(B2:B), IF((B2:B>=C2:C)*(B2:B<=D2:D), TRUE, FALSE), ))

Both formulas return TRUE if the result falls within the limits, FALSE otherwise.

Why ISBETWEEN is Recommended:

  • Simpler to read and learn.
  • Automatically returns #NUM! if the lower limit is greater than the upper limit, which helps catch data errors.
#NUM error shown when lower limit is greater than upper limit using ISBETWEEN

Highlight Out-of-Range Test Results

To highlight values outside their limits using conditional formatting:

  1. Select cell B2.
  2. Go to Format → Conditional formatting.
  3. Set Apply to range: B2:B1000.
  4. Under Format rules, choose Custom formula is.
  5. Enter:
=ISBETWEEN($B2, $C2, $D2)=FALSE
  1. Set the formatting style (e.g., red text, bold).
  2. Click Done.
Conditional formatting panel in Google Sheets highlighting out-of-range test results with ISBETWEEN

This highlights all results that do not fall within their range.

Key Takeaways

  • Use ISBETWEEN to easily test if values fall within a range.
  • Comparison operators provide an alternative, but formulas are more complex.
  • ISBETWEEN works with numbers, dates, or text, and handles multiple arrays.
  • Conditional formatting can flag out-of-range values visually.

Resources

Prashanth K V
Prashanth K V
Your Trusted Google Sheets and Excel Expert Prashanth K V is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

How to Use the SHEET and SHEETS Functions in Google Sheets

The SHEET and SHEETS functions let you retrieve information about worksheets in a Google...

How to Create a Self-Healing Table of Contents in Google Sheets

A table of contents makes navigating large Google Sheets workbooks much easier. However, a...

Sort a Tab Name List Dynamically by Workbook Order in Google Sheets

When your workbook contains many sheets (tabs), you may create a table of contents...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.