How do I set up a conditional function in Excel

K

Kamsa

Help, I think I have done this before but cannot remember or how I did it.

For a risk log, I want a formular that will pick up from 2 cells a number of
combinations and give me the result in the third cell

ie. Risk If cell a is "L" and cell b "L@ then cell c should be "L"
however if a is "L" and cell b is "M" then cell c should "M"
and if a is "L and b is "H" then c should be "M"
and if a is "M" and b is "H" then c should "H"
 
B

Bob Phillips

=IF(A2="L",IF(B2="L","L",IF(OR(B2="M",B2="H"),"M","")),IF(AND(A2="M",B2="H")
,"H",""))

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
P

Peo Sjoblom

One way

=IF(AND(A1="L",B1="L@"),A1,IF(AND(A1="L",B1="M"),B1,IF(AND(A1="L",B1="H"),"M
",IF(AND(A1="M",B1="H"),B1,""))))

assuming that if neither of the conditions are true, blank result


Regards,

Peo Sjoblom
 
M

Max

One way ..

Assuming lookup values in cols A and B, from row1 down

Put in the formula bar for C1,
array-enter (press CTRL+SHIFT+ENTER):

=INDEX({"L";"M";"M";"H"},
MATCH(1,(A1={"L";"L";"L";"M"})*(B1={"L@";"M";"H";"H"}),0))

Copy C1 down
 
B

Bob Phillips

I think the @ was a typo, there was no closing quote. I made the same
mistake until I saw the hyperlinking <G>

Bob
 
M

Max

I think the @ was a typo, there was no closing quote. I made the same
mistake until I saw the hyperlinking <G>

Aha, you're right, I fell for it, just like Peo <g>
Great razor-sharp eyesight there, Bob !
 
A

Alok

Another way which uses an in memory table and vlookup.

=IF(ISNA(VLOOKUP(A1 &
B1,{"LL","L";"LM","M";"LH","M";"MH","H"},2,FALSE)),"",VLOOKUP(A1 &
B1,{"LL","L";"LM","M";"LH","M";"MH","H"},2,FALSE))

Alok
 

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