It works by testing to see if a certain condition is true. If it is, the function enters one result in a specific cell, if it is not; it enters a different result in that cell.
The usefulness of the IF function can be increased by "nesting" one IF function inside another. This increases the number of conditions that can be tested as well as increasing the number of possible outcomes.
To find out how to nest IF functions, read the step by step Excel 2007 Nested IF Function tutorial.