The IF function performs a logical test and returns one value if true and another if false. For example, =IF(A1 > 10, "High", "Low") checks if A1 is greater than 10.