Formula Errors

Excel Formula to Compare the Highest and Lowest Values

Muhammad TalhaMuhammad Talha Nov 25, 2026 870 views

Question details

Create a formula that returns a result based on the difference between the highest and lowest values in a range.

Excel Formula to Compare the Highest and Lowest Values
Product
Microsoft Excel
Device & OS
not provided
Scenario
Compare the spread of values in a cell range with a threshold such as 5.
Observed behavior
The desired result is 1 when the difference is 5 or less and 2 when it is greater than 5.
Before you start

Identify the cell range containing the numbers you want to compare and choose a blank cell for the result. Check that the range contains numeric values rather than numbers stored as text.

Solution 1Recommended

Use IF, MAX, and MIN to evaluate the difference

Use this formula to return one of two values depending on whether the range's spread exceeds a threshold.

1
Select a result cell

In your Excel worksheet, click a blank cell where you want the result to appear.

2
Enter the formula

Type =IF(MAX(A1:C3)-MIN(A1:C3)<=5,1,2) in the cell or formula bar, then press Enter.

3
Adjust the range and threshold

Replace A1:C3 with your data range, such as H108:L112. Change 5, 1, or 2 in the formula if you need a different threshold or output.

Use IF, MAX, and MIN to evaluate the difference
How the result is determined: The formula returns 1 when the highest value minus the lowest value is 5 or less, including exactly 5. It returns 2 when the difference is greater than 5.
WPS Spreadsheets

Compare highest and lowest values in WPS Spreadsheets

Use the same IF, MAX, and MIN formula in WPS Spreadsheets to evaluate the spread of values and return a result.

  1. 1. Open your spreadsheet: Open WPS Spreadsheets and use Open to select your workbook.
  2. 2. Choose a result cell: Click a blank cell outside the range you want to compare.
  3. 3. Enter the formula: Type =IF(MAX(A1:C3)-MIN(A1:C3)<=5,1,2), replace A1:C3 with your range, and press Enter.
  4. 4. Save the workbook: Choose File > Save or Save As to save your changes in the desired format.
Compare a range against a threshold with familiar spreadsheet functionsOpen and edit Microsoft Excel XLS and XLSX filesWork with formulas in a familiar spreadsheet interfaceUse WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

How do I return just the difference between the highest and lowest values?

Enter =MAX(A1:C3)-MIN(A1:C3) in a blank cell, replacing A1:C3 with your range.

What happens if the difference is exactly 5?

In =IF(MAX(A1:C3)-MIN(A1:C3)<=5,1,2), the result is 1 because <= includes values equal to 5.

How can I return TRUE or FALSE instead of 1 or 2?

Enter =MAX(A1:C3)-MIN(A1:C3)>5 to return TRUE when the difference is greater than 5 and FALSE otherwise.

How can I leave the result blank when the range has no numbers?

Use =IF(COUNT(A1:C3)=0,"",IF(MAX(A1:C3)-MIN(A1:C3)<=5,1,2)). Replace A1:C3 with your range.