The IF function in Excel allows you to write conditional logic in a cell. It has the following structure: =IF(logical_test, value_if_true, value_if_false) The logical_test is a cell reference, value, or formula that evaluates to True or False. If true, it returns the value_if_true. If false, it returns the value_if_false. Examples show using IF statements to check cell values and return text like "Correct" or "Incorrect" depending on the outcome of the logical test.