Unexpected result from IF statement... Help with formula.

M

Monomeeth

Okay, not sure why this isn't working so need your help.

In cell AA2 I have the following formula: =TODAY()
In cell AB2 I have the following formula: =MONTH(AA2)

Cell AA2 returns today's date. Cell AB2 returns the month of the date in
AA2. So far so good.

Now here's the problem:

In Cell C3 I have the following formula: =IF(AB2="5",AB6,"")

But for some reason this returns a blank result. Because we're in May, cell
AB2 does = 5, so that tells me that in cell C3 I should get the result of
whatever is in cell AB6. Cell AB6 has $35,500.00 in it, and this is what I
was expecting to get in cell C3.

I want to get this sorted out as I intend to have a nested IF statement to
allow for twelve possibilities ranging from 1 to 12.

Any suggestions of how to fix this? Or is there a better way to achieve the
same thing?

And, will I run into problems if I have twelve IF statements in my formula,
or will Excel handle that ok?

I'm using Excel 2003 SP2.

Thanks.

Joe.
 
J

Joel

The today function returns a Number, You are testing for a string. They are
not equal.

from
=IF(AB2="5",AB6,"")
to
=IF(AB2=5,AB6,"")
 
M

Monomeeth

Hi Joel

Thanks for your help. That solved the problem, but now I can't seem to nest
additional IF statements in the formula without an error?

The formula I now have is:

=IF(AB2=4,AB6),IF(AB2=5,AC6),IF(AB2=6,AD6),"")))

Any idea what I'm doing wrong now?

Also, would you happen to know if I can have the formular cater for twelve
values? The above formula only caters for three (i.e. 4, 5 or 6) but I will
need to eventually make it cater for twelve values from 1 to 12.

Thanks again for your help! It is much appreciated!
 
M

Monomeeth

Solved it - I think. I'm now using the following formula:

=IF(AB2=4,AB6,IF(AB2=5,AC6,IF(AB2=6,AD6,"")))

....and that seems to work.

Now, I guess I'll try it with twelve values and see what happens. Thanks for
your help Joel!
 

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