ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF Statement (https://www.excelbanter.com/excel-worksheet-functions/147160-if-statement.html)

Bob

IF Statement
 
If D3 contains the string "pn" and if E3 contains either "m" or "a", I want
the value in I3 to be 1.

If D3 does not contain "pn" and E3 does not contain "M" or "A", I want I3 to
be zero.

Can someone provide a formula to do this?

Thanks very much,
Bob

christine b

IF Statement
 
Hi Bob, I'm not an expert, but this works when used in cell I3

=IF(AND(D3="pn",OR(E3="m",E3="n")),1,0)

I am assuming that you want both "pn" and either of M or N to be present.
Again, I'm just a user, perhaps an MVP will have an easier way.

Christine



"bob" wrote:

If D3 contains the string "pn" and if E3 contains either "m" or "a", I want
the value in I3 to be 1.

If D3 does not contain "pn" and E3 does not contain "M" or "A", I want I3 to
be zero.

Can someone provide a formula to do this?

Thanks very much,
Bob


Teethless mama

IF Statement
 
Try this:

=AND(D3="pn",OR(E3={"m","n"}))+0


"bob" wrote:

If D3 contains the string "pn" and if E3 contains either "m" or "a", I want
the value in I3 to be 1.

If D3 does not contain "pn" and E3 does not contain "M" or "A", I want I3 to
be zero.

Can someone provide a formula to do this?

Thanks very much,
Bob


christine b

IF Statement
 
Good one.
There's always someone who thinks outside the box. LOL



"Teethless mama" wrote:

Try this:

=AND(D3="pn",OR(E3={"m","n"}))+0


"bob" wrote:

If D3 contains the string "pn" and if E3 contains either "m" or "a", I want
the value in I3 to be 1.

If D3 does not contain "pn" and E3 does not contain "M" or "A", I want I3 to
be zero.

Can someone provide a formula to do this?

Thanks very much,
Bob


Rick Rothstein \(MVP - VB\)

IF Statement
 
If D3 contains the string "pn" and if E3 contains either "m" or "a", I
want
the value in I3 to be 1.

If D3 does not contain "pn" and E3 does not contain "M" or "A", I want I3
to
be zero.

Can someone provide a formula to do this?

Try this:

=AND(D3="pn",OR(E3={"m","n"}))+0


I believe your formula can be tightened up a little bit more....

=(D3="pn")*OR(E3={"m","n"})

Rick



All times are GMT +1. The time now is 07:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com