When the value in column B is within +/- .005 of 0.250 (from column C), the formula returns "OK". If not, the formula returns "Fail".
In this example the goal is to check if values in column B are within a tolerance of .005. If a value is within tolerance, the formula should return "OK". If the value is out of tolerance, the formula should return "Fail". The expected value is listed in column C, and the allowed tolerance is listed in column D. The solution is based on the IF function together with the ABS function.
To check if a value is within a given tolerance, we can use a simple logical test like this:
Inside the ABS function, the actual value is subtracted from the expected value. The result may be positive or negative, depending on the actual value, so the ABS function is used to convert the result to a positive number: negative values become positive and positive values are unchanged. The result from ABS is compared to the allowed tolerance with the logical operator less than or equal (<=). The expression returns TRUE when a value is less than or equal to the allowed tolerance, and FALSE if not.
To complete the solution, we need to place the generic logical expression above into the IF function and providing values for a TRUE and FALSE result. The first step is to revise the generic expression above to use worksheet references:
At the core, this formula runs two tests on a value like this: = D5 > MIN ( B5 , C5 ) // is D5 greater than smaller? = D5 < MAX ( B5 , C5 )) // is D5 less than larger? In the first expression, the value is compared to the smaller of the two...
This formula counts how many values are not in range of a fixed tolerance. The variation of each value is calculated with this: ABS ( data - target ) Because the named range "data" contains 10 values, subtracting the target value in F4 will created...
In this example, the goal is to list values in a given group that are within a given tolerance. The group is set in cell G4, and the target value is entered in cell G5. The allowed tolerance is entered in cell G6. The data comes from an Excel Table...
The IF function runs a logical test and returns one value for a TRUE result, and another for a FALSE result. For example, to "pass" scores above 70: =IF(A1>70,"Pass","Fail"). More than one condition can be tested by nesting IF functions. The IF...
The Excel ABS function returns the absolute value of a number. ABS converts negative numbers to positive numbers, and positive numbers are unaffected.
Excel Formula Training
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.