Whats better Lookup or Function Formula

G

Guest

Im am trying to calculate the following. What is the best way to do it.

if C2 <> C1 (value of prev row same col)
and if D2="O" or "B" then F2= 1 (numeric result)

else if C2 = C1 (value of prev row same col)
and if D2="B" then F2= 2 (numeric result)
or if D2="S" then F2= 3 (numeric result)
or if D2="X" then F2= 4 (numeric result)
else "Error"

How would I write the formula??
 
B

Bob Phillips

=IF(C2<>C1,IF(D2="O",1,"what in this
case??"),IF(D2="B",2,IF(D2="S",3,IF(D2="X",4,"Error!!"))))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
J

JE McGimpsey

One way:

F2: =IF(C2<>C1, IF(OR(D2="O", D2="B"), 1, "Error"), IF(D2="B", 2,
IF(D2="S", 3, IF(D2="X", 4, "Error"))))
 
G

Guest

=IF(AND(C2<>C1,OR(D2={"O","B"})),1,IF(C2=C1,IF(D2="B",2,IF(D2="S",3,IF(D2="X",4,"Error"))),"Error"))
 

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