If
Then Else
_____________________________________________________________________
Business Computing Tips
By K&K Fainges kfainges@bigpond.net.au
The If, Then, Else functions in excel seem very hard to use, but with the
wizard, they can make sense more easily and they give you a great deal of
control over your excel spreadsheets.
The function means just what is says, if something is true, do one thing,
otherwise do something else. For example, say you have a list of petty cash
receipts and you want to add up all the amounts for milk but not any of the
others.
Go to INSERT, FUNCTION, and select IF. The wizard box will come up with 3
areas to fill in.
The first box is the bit that changes. Click on the cell that you want to
test, then type what you want to be 'true', in this case, milk. Because it is
a word and not a number, it needs to have quotation marks around it. So it
becomes A1='milk'.
Then, in the second box, click on the cell with the number in it that you want
to add up in this case B1.
Then in the third box, put what you want it to do if it's not milk, in this
case put a zero. Then hit enter. The formula will look like =IF(A1="milk",B1,0).
Then put your mouse in the bottom right hand corner of the cell with the
finished formula in it and it will change into a cross. Click, hold the button
down, and drag it down the list. This will 'fill' the function in for all the
other rows, changing the cells to the right ones as well, i.e. the next line
will automatically be =IF(A2="milk",B2,0).
Then if you 'sum' then column, viola, all the milk for the list added up.