# Logical expression for excel..

#### 81shelly

##### New Member
How could you put this sequence in excel..

If A AND B are true return x if false return z

OR IF C>=D is true return y if false return z

Is it possible to put the whole thing on one formula?

Thanks

### Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

#### Jonmo1

##### MrExcel MVP
Code:
``=IF(AND(A,B),"x",IF(C>=D,"y","z"))``

#### Gerald Higgins

##### Well-known Member
Yes, but I think we'd need to understand the logic better.

How do you define that A and B are true ?

If they are both true, what if C>+D is also true ?

If the decision process is as follows, then you can write a formula for it -
If A AND B are both true, return X.
If A AND B are not both true, but C>+D is true, return Y.
Otherwise, return Z.

If this isn't the correct logic, you can still write a formula for it, but you'd need to be clear about what the logic is.

#### Gerald Higgins

##### Well-known Member
Jonmo1 - I don't think your solution addresses the implied requirement from the OP to return z in any occurrence of A and B not being true.

#### 81shelly

##### New Member
thanks thats exactly the way i wanted it..

#### Jonmo1

##### MrExcel MVP
Sure it does. If Either A or B is False, it moves on to the next IF, If C>=D - if that is not true, it returns "z"

#### Gerald Higgins

##### Well-known Member
jonmo1 - it's clearly what 81shelly wanted, but it's not what he said he wanted in the OP, which says
If A AND B are true return x if false return z

Anyway well done for correctly interpreting their request !

Replies
4
Views
894
Replies
1
Views
394
Replies
3
Views
2K
Replies
4
Views
689
Replies
6
Views
455

1,181,398
Messages
5,929,739
Members
436,686
Latest member
chanmeggichan

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back