Excel Formula to Compare the Highest and Lowest Values
Question details
Create a formula that returns a result based on the difference between the highest and lowest values in a range.

- 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.
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.
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.
In your Excel worksheet, click a blank cell where you want the result to appear.
Type =IF(MAX(A1:C3)-MIN(A1:C3)<=5,1,2) in the cell or formula bar, then press Enter.
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.

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. Open your spreadsheet: Open WPS Spreadsheets and use Open to select your workbook.
- 2. Choose a result cell: Click a blank cell outside the range you want to compare.
- 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. Save the workbook: Choose File > Save or Save As to save your changes in the desired format.

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.




