 SOLVED

New Contributor

if statement returning only false condition value

I am using windows 10 with an excel version MS office Home and Student 2016. When I use "if" statement with "AND" or nested if, or even only a simple "if", it is giving out result as only false condition value of the statement though the condition is true in the file.

2 Replies
best response confirmed by kaivalyap (New Contributor)
Solution

Re: if statement returning only false condition value

@kaivalyap

In K16, you use a test like D16<I15<C16. Excel first evaluates D16<I15, resulting in TRUE or FALSE. Then, it evaluates if TRUE (or FALSE) is less than C16. That's where your formula breaks as it will always return FALSE. Now, you could turn a TRUE or a FALSE into a 1 or a 0, but then the outcome would most likely always be TRUE. To overcome this, you need to be specific when you write the formula and state that D15 must be less than I15 AND that I15 must be less than C16.

Now, I haven't tried to understand the logic for "buy" or "sell", but the attached formula returns all of the three possible outcomes. Up to you to decide if the applied logic is correct.