Nested If statement revisited

P

pdgood

Please forgive my ignorance, I am new to this.
My question is almost identical to the previous post, but I was unable
to understand that answer.
My problem is that I have two ifs that need to be satisfied before
returning an answer. Example:
If B10="X" and A2>B2 then 2*A2
If B10="X" and B2>A2 then 2*B2
If B10 doesn not = "X" then 0

I know how to write the simple version
=IF((B10="X"),2*A2,0)
but I'm not sure where to place the extra argument or what term to use
to add another one. (& or AND or whatever). I've tried them
all....except the right one, apparently.

Someone suggested VLOOKUP tables and I looked that up in my manual but
it seems to indicate referencing a set table which this does not seem
to have. Perhaps I don't understand correctly.
In any event, the first scenario I mentioned is easier to understand,
if I can just figure out how to include one more argument.
Any ideas?
Thanks so much.
 
R

Ron Coderre

I think this method will save you a step or two:

=IF(B10="X",2*MAX(A2:B2),0)

OR you could even go this way:

=(B10="X")*MAX(A2:B2)*2

Does that help?

Regards,
Ron
 
J

JE McGimpsey

One way:

=IF(B10="X", IF(A2>B2, 2*A2, 2*B2), 0)

However, you could simplify that as

=IF(B10="X", 2 * MAX(A2,B2), 0)

And since XL coverts TRUE/FALSE values to 1/0, respectively, in math
operations, you could simplify this a bit more:

=(B10<>"X") * 2 * MAX(A2,B2)
 
P

pdgood

You guys are amazing! And the response time in this forum is
unbelieveable.
Many, many thanks.
 
Top