Excel: Find the Highest Value Within a Plus-or-Minus Range
Question details
Find the maximum value in one column for rows where another column is within a specified tolerance of a target.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Column J contains measured values, column N contains results, J8132 contains the target, and T1 contains the allowed tolerance.
- Observed behavior
- The desired result is the highest value in column N for rows whose column J value falls between the target minus the tolerance and the target plus the tolerance, inclusive.
Check that the target in J8132 and the tolerance in T1 are numeric, and that the tolerance is nonnegative. Make sure the measured-value and result ranges cover the same rows.
Use MAXIFS to Find the Highest Result Within the Tolerance
Use this formula when your version of Excel supports MAXIFS and you want to include both range boundaries.
Click an empty cell where you want the maximum result to appear.
Type =MAXIFS(N8168:N8171,J8168:J8171,">="&$J$8132-$T$1,J8168:J8171,"<="&$J$8132+$T$1) and press Enter.
Replace N8168:N8171 and J8168:J8171 with your result and measured-value ranges, keeping their rows aligned. To use a fixed tolerance, replace each $T$1 with a number such as 5.

Find a Maximum Within a Tolerance in WPS Spreadsheets
Open your workbook in WPS Spreadsheets and use MAXIFS to find the highest result whose measured value falls within the target range.
- 1. Open the workbook: In WPS Spreadsheets, select Open and choose your Excel workbook.
- 2. Check the inputs: Enter or confirm the target in J8132 and a nonnegative tolerance in T1. Check that columns J and N contain the measured values and results for the same rows.
- 3. Enter MAXIFS: Click an empty cell, enter =MAXIFS(N8168:N8171,J8168:J8171,">="&$J$8132-$T$1,J8168:J8171,"<="&$J$8132+$T$1), and press Enter.
- 4. Adapt the ranges: Edit the J and N ranges in the formula to cover your data, then use File > Save to save the workbook.

Frequently Asked Questions
Does the formula include values exactly at the tolerance limits?
Yes. The >= and <= criteria include values equal to the target minus the tolerance and the target plus the tolerance.
How do I use a fixed tolerance of 5?
Replace both instances of $T$1 in the MAXIFS formula with 5. The criteria will then use $J$8132-5 and $J$8132+5.
Why does MAXIFS return 0?
A zero can be a genuine maximum, but MAXIFS also returns 0 when no rows meet the criteria. Use COUNTIFS with the same lower and upper limits to check whether any rows match.
What do the dollar signs in $J$8132 and $T$1 do?
They keep the target and tolerance references fixed when you copy the formula to another cell. The data ranges can still change unless you also make them absolute.




