Thread: IF Statement
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default IF Statement

"timmadge" wrote:
=IF(AND(D126<$I$1,G126="Bts D",G126="Bts
C",2,G126="Asda",G126="Wmm"),"1","")
How do you have a true and false for each option.


To begin with, the above IF() condition is either nonsense or
purposely always false. Since G126 cannot have "Bts D" and
"Bts C" etc at the same time, the AND() function is always false.

I suspect you simply do not know how to write the condition.
You should start with asking for help there. As a wild guess:

=IF(AND(D126<$I$1,OR(G126="Bts D",G126="Bts C")), 2,
IF(AND(D126<$I$1,OR(G126="Asda",G126="Wmm")), 1, ""))

That could be rewritten as:

=IF(D126<$I$1, IF(OR(G126="Bts D",G126="Bts C"), 2,
IF(OR(G126="Asda",G126="Wmm"), 1, "")), "")

But you might have meant something different altogether.

How do you have a true and false for each option.
Bts D = 1 False = ""
Bts C = 2 False = ""
Asda = 3 False = ""
Wmm = 4 False = ""


I have no idea what those equations have to do with the formula.
Perhaps you can explain.

My understanding is that you would like to test the correctness
of your IF() with varying combinations of values for D126, $I$1
and G126. At least, that is what you __should__ be asking ;-).

One way is to recognize that you have 15 conditions to deal
with and to manually change the values of each dependent cell
accordingly and be sure the result is what you expect. The
conditions are all pairs of the following sets:

1. D126 < $I$1; D126 = $I$1; D126 $I$1
2. G126 has "Bts D", "Bts C", "Asda", "Wmm", something else

In other words, you would put values into D126 and $I$1 such
that D126 < $I$1, then put each of the 5 possibilities into G126.
Repeat with values in D126 and $I$1 such that D126 = $I$1;
then repeat with values such that D126 $I$1.

If you are interested in a "truth table" solution, please say so.
That is different problem altogether.