IF and THEN statements

A

Athena

I'm currently working on a spreadsheet that is becoming more complicated in
formula needs than I can manage on my own. I was wondering if someone would
be kind enough to assist me with a solution on how to incorporate IF and THEN
statements.

Current Problem: I have this: #DIV/0! showing up in some of my cells
currently because there are no numbers to calculate. The results are
basically zero. However, I would like it to show that IF the formula results
in ZERO, THEN place a 0 instead of the #DIV/0! text in the cell. The
current formula in the cell is:

=SUM(L16/'2008'!G16

My Question: How do I use an IF and THEN statement with the above formula
to place a zero number in the cell if there are no numbers to calculate?

Thank you so much in advance for being a help to me.
 
M

Mike H

Hi,

Try this and note there's no need for SUM

=IF('2008'!G16<>0,L16/'2008'!G16,0)

Mike
 
T

Tom Hutchins

If you are just dividing two numbers, you don't need to use SUM. Your IF
formula should check the number by which you are dividing. If it's zero,
return zero; otherwise, go ahead and do the division.

=IF('2008'!G16=0,0,L16/'2008'!G16)

Hope this helps,

Hutch
 
L

Luke M

IF functions create routes for TRUE/FALSE outcomes. In your case, since
'2008'!G16 is the possible trouble maker, we'll check it first to determine
our outcome:

=IF('2008'!G16=0,0,L16/'2008'!G16)

Note that there is no need for the SUM function, as you are not actually
summing an array of numbers, but rather performing a single math operation.
 
B

Bernard Liengme

Let's start with =SUM(L16/'2008'!G16)
There is no need to use SUM when you are doing a simple math operation like
divide
This is what you need
=L16/'2008'!G16
We use SUM as in =SUM(A1:A100) to sum all the vlaues in a range

Now let's get that zero
=IF('2008'!G16=0, 0, L16/'2008'!G16)
or
=IF(ISERR(L16/'2008'!G16),0,L16/'2008'!G16)

But is zero really what you need? Maybe a cell that looks empty would be
better
=IF('2008'!G16=0, "" L16/'2008'!G16)
That is a pair of double-quotes with nothing between

best wishes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top