IF Function

W

watermt

I have a formula using the IF function and am having trouble making it work.
The formula:

Cell Q22
=IF(E22=3,IF(O22>3,"NC", "C"),IF(O22<3,"C", "NC"))

Cell R22
=IF(E22=10,IF(O22>10,"NC", "C"),IF(O22<10,"C", "NC"))

What I'm trying to do is show either "C" or "NC" in cell Q22 (for number 3
selected in cell E22) or R22 (for number 10 selected in cell E22).

If cell Q22 displays "C" or "NC", I want cell R22 to remain blank; If cell
R22 displays "C" or "NC", I want cell Q22 to remain blank.

I hope this makes sense, I tried to and an OR function but it said I had too
many variables for this function. can someone help me with this?

Thanks,
Mike
 
S

Shane Devenshire

Hi,

I think what you want is:

=IF(E22=3,IF(O22>3,"NC", "C"))

and

=IF(E22=10,IF(O22>10,"NC", "C"))

The question is what do you want to display if E22 does not equal 3 or 10?
 
J

JoeU2004

watermt said:
What I'm trying to do is show either "C" or "NC" in cell Q22 (for
number 3 selected in cell E22) or R22 (for number 10 selected in
cell E22).

That sounds fine. So you want logic that looks like this:

Q22: =if(E22=3, something, "")
R22: =if(E22=10, something, "")
If cell Q22 displays "C" or "NC", I want cell R22 to remain blank;
If cell R22 displays "C" or "NC", I want cell Q22 to remain blank.

The above paradigm will ensure that. However, there is also a case when
__both__ Q22 and R22 are blank, namely when E22 is __neither__ 3 nor 10. Is
that okay?

If this is on the right track, the question is: what is "something" in the
Q22 and R22 formulas?

Unfortunately, your intent is unclear from your IF() expressions. Perhaps
the following will suffice:

Q22: =if(E22=3, if(O22>3,"NC","C"), "")
R22: =if(E22=10, if(O22>10,"NC","C"), "")

This is different from your IF() expressions. You should test with E22 not
3 or 10 __and__ O22 <3, =3 and >3 to be sure you are getting the desired
result.

If it is not the desired result in some cases, please post an update to this
thread with all the cases filled in the following matrix for each of
(separately) Q22 and R22:

E22 O22<3 O22=3 O22>3
----
3
10
not 3 or 10

HTH.


----- original posting -----
 
W

watermt

Thanks JoeU2004! Your formula worked:

Q22: =if(E22=3, if(O22>3,"NC","C"), "")
R22: =if(E22=10, if(O22>10,"NC","C"), "")

If cellE22 is blank then both Q22 and R22 should also be blank. And if the
selection is 3 in cell E22 only the _if(O22>3,"NC","C"), "")_ applies and
vice-versa if cell E22 is 10.

Sorry for not expressing that very well in the beginning of this discussion!

Thanks, Mike
 

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