ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple Condition syntax needed (https://www.excelbanter.com/excel-programming/299926-multiple-condition-syntax-needed.html)

Jetheat

Multiple Condition syntax needed
 
Ok, I'm making a spreadsheet which does simple stuff.

One of the boxes displays a word based on other conditions.
Here is the formula so far:

=IF(AND(D5=\"B\",F5E5),\"PROFIT\",\"LOSS\")

Which says If Cell D5 has the letter "B" in it AND the number in cell
F5 is greater than E5, then print "Profit", otherwise print Loss.

In the same box, I'd like to make another statement which says

If cell D5 = the letter "S" and F5 is less than E5, then Print
"Profit", otherwise print "Loss".

So the 1st statement will be connected to the 2nd statement with an OR
operator or something like that.
Therefore only one of these conditions is true.

Any idea how I can code it?


---
Message posted from http://www.ExcelForum.com/


Frank Kabel

Multiple Condition syntax needed
 
Hi
try
=IF(OR(AND(D5="B",F5E5),AND(D5="S",F5<E5)),"PROFI T","LOSS")

not sure about your charatcer '\' in your current formula?


--
Regards
Frank Kabel
Frankfurt, Germany


Ok, I'm making a spreadsheet which does simple stuff.

One of the boxes displays a word based on other conditions.
Here is the formula so far:

=IF(AND(D5=\"B\",F5E5),\"PROFIT\",\"LOSS\")

Which says If Cell D5 has the letter "B" in it AND the number in cell
F5 is greater than E5, then print "Profit", otherwise print Loss.

In the same box, I'd like to make another statement which says

If cell D5 = the letter "S" and F5 is less than E5, then Print
"Profit", otherwise print "Loss".

So the 1st statement will be connected to the 2nd statement with an

OR
operator or something like that.
Therefore only one of these conditions is true.

Any idea how I can code it?


---
Message posted from http://www.ExcelForum.com/



Jetheat[_2_]

Multiple Condition syntax needed
 
That's great. Works fine. Just to take it one step further, How do
display Nothing in the formula box if the D5 cell contains anythin
other than "B" or "S"?

At the moment, it will display Loss if anything other than B or S is i
cell D5

Appreciate the hel

--
Message posted from http://www.ExcelForum.com


Jetheat[_3_]

Multiple Condition syntax needed
 
Its ok, figured it out from another guy,

=IF(AND(D5<"B",D5<"S"),"",IF(OR(AND(D5="S",F5<E5 ),AND(D5="B",F5E5)),"Profit","Loss"))

Thank

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 03:12 AM.

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