If Formula (2010)

iksotof
3StarLounger
Posts: 315
Joined: 04 May 2010, 15:18

If Formula (2010)

Post by iksotof »

Hi, I am struggling with a formula to return true from a combination of values from two cells, for instance I want the value to be true if say cell A1 = 1 and cell B1 = 2 or 3, any other combinations would be false.

Kind regards Darren

User avatar
HansV
Administrator
Posts: 78636
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: If Formula (2010)

Post by HansV »

Hi Darren,

Try this formula:

=AND(A1=1,OR(B1=2,B1=3))
Best wishes,
Hans

iksotof
3StarLounger
Posts: 315
Joined: 04 May 2010, 15:18

Re: If Formula (2010)

Post by iksotof »

Thanks Hans,

That works but I now realise I have not made it entirely clear what I need. The comparing works but I need it to return
values other than true or false, say "XXX" for true and "YYY" for false?

Kind Regards

User avatar
HansV
Administrator
Posts: 78636
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: If Formula (2010)

Post by HansV »

Then you can use

=IF(AND(A1=1,OR(B1=2,B1=3)),"text if true","text if false")

substituting the appropriate text strings.
Best wishes,
Hans

iksotof
3StarLounger
Posts: 315
Joined: 04 May 2010, 15:18

Re: If Formula (2010)

Post by iksotof »

Thanks Hans, it's been a few years but you're still the top!