Nested IF Statement

S

Secret Squirrel

I'm trying to work an IF statement with these conditions:

If E2 = "Open" then U2
If E2 = "Closed" & S2 = "" then T2, and if E2 = "Closed" and S2 is not blank
then ""

I've tried this a few different ways but haven't been able to come up with
my solution. Can anyone help me write this?
 
S

Sandy Mann

What happens if the entries are not exactly as you specified? I have the
formula returning "Your Data is not correct"

=IF(TRIM(E2)="Open","",IF(AND(TRIM(E2)="Closed",TRIM(S2)=""),T2,IF(AND(TRIM(E2)="Closed",S2<>""),"","Your
Data is not correct")))

The TRIM() function are to take care of any spaces that you previously
reported in your data

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
 
S

Secret Squirrel

I tried using the fx button but I can't seem to figure out how to create
nested if statements using that button. Can you help shed some light on this?
 
B

Bob Phillips

=IF(E2="Open",U2,IF(E2="Closed",IF(S2="",T2,""),"")

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
S

Secret Squirrel

Good point. Here's a more detailed layout of what I'm looking for

If E2 is "Open" then in cell X2 I want the value of U2.
If E2 is "Closed" and S2 is 0 then I want the value in X2 to be T2.
And if E2 is "Closed" and S2 is greater than 0 then I want the value in X2
to be 0.
 
S

Sandy Mann

Bob Phillips said:
=IF(E2="Open",U2,IF(E2="Closed",IF(S2="",T2,""),"")


Yes - Just as well that one of us can read<g>

--
Regards,

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
 
S

Secret Squirrel

That will work but since the format in S2 is Accounting how do I tell the
formula that a "$ - " is the same as "" in the formula?
 
T

Tom Ogilvy

if the cell is formatted as accounting and it displays as $ - then it
contains a zero - it isn't the same as "". If it is empty, it looks empty
for me.

In any event, for currency formatting, the if formula will look at what is
stored in the cell, not how it appears
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top