IF/THEN STATEMENTS
Whether or not you took logic in college, if/then statements are easy to understand. "If it is raining, then we will not go outside for recess" is an example. If one thing happens, then another thing must happen.
In Microsoft Excel, we can use if/then statements to check an answer and to have a special icon appear if the answer is right or wrong. For example, if the answer to "2+2" is 4, we tell Excel that if a student types a "4," then a happy face should appear. If a student types anything else, a sad face should appear.
So, let's type an if/then statement for our worksheet. Click in cell C2, and type
=IF(B2=2,"J","L"). You must type every symbol and space correctly or you will get an error message. Don't space after the commas as you normally would.

You now should have an L in cell C2.
Why does our statement look like that?
- - tells Excel it's an if/then statement.
- B2=2 tells Excel that the condition we're are testing is that this cell is equal to the number 2. (The number 2 has been typed in cell C2).
- "J" tells Excel what to put in the cell if the condition is true. (If a student typed a 2 in cell C2).
- "L" tells Excel what to put in the cell if the condition is false. (If a student typed something other than a 2 in cell C2).
Type a 2 in cell B2 to see the letter J pop up instead. Why on earth should you type a "J" if the answer's correct and an "L" if the answer's wrong? It's happy face time. Save your work and read on!
Next: Happy face/sad face.
|