teaching if statements


Posted by d on January 24, 2001 1:38 PM

I'm teaching if and nested if statements for the first time. Many are still confused. Any tips? Any resources for more if and nested if statement exercises?

Posted by Mark W. on January 24, 2001 1:41 PM

What's the confusion?

Posted by Mark W. on January 24, 2001 1:55 PM

If they're struggling with keeping the nesting
organized consider putting each argument on a
separate line and using indentation to visualize
the nesting.

For example, use:

=IF(A1,
IF(B1,
C1,
D1),
E1)

instead of: =IF(A1,IF(B1,C1,D1),E1).

The line wraps are accomplished using Alt+Enter.

Also, be sure and instruct them on how Excel tracks
the parenthesis pairings with colors. Finally,
make sure and show them how they can evaluate
formula fragments by selecting parts of the formula
(e.g., IF(B1,C1,D1)) and then pressing Ctrl+=.

Posted by Mark W. on January 24, 2001 1:57 PM

Nested IFs...

Because of the way these messages post my indentation
wasn't preserved it looked something like this:


=IF(A1,
____IF(B1,
_______C1,
_______D1),
____E1)

Posted by Loren on January 24, 2001 2:05 PM

I suggest showing them how to draw flow charts like
programers used to do it. Diamond shape for decision,
circles, squares.

Posted by Aladin Akyurek on January 24, 2001 2:41 PM

Re: Nested IFs...

This is much better.

May I give an advice: Nested IFs is a burden for human cognition. I tell my students not to go beyond ~3 nested IFs. The maxim that I use is: "If more required, rethink the problem you want to solve."

Btw, I often use tables (in Word) to show the argument sctructure.

Aladin



Posted by Aladin Akyurek on January 24, 2001 2:45 PM

Loren: it's a good suggestion if the student is fairly fluent in flow charts. Otherwise, you get 2 "languages" that you have to teach.

Aladin