?
Solved

IF/OR/AND Statement

Posted on 2011-10-03
5
Medium Priority
?
300 Views
Last Modified: 2012-05-12
Hi,
I have attached an IF statement i made that is failing on certain pieces of data.

I may have constructed it incorrectly

The logic of the the IF is:

IF A2= FIT or FIJ and J2 = buy, leave O2 as it is

IF A2= FIT or FIJ and J2 = sel, multiply O2*-1

IF A2 = SIT and J2 = Buy, multiply o2*-1

IF A2 = SIT and J2 = sel, leave O2 as it is

I have attached the IF below

Thanks
Seamus




test.xls
0
Comment
Question by:Seamus2626
5 Comments
 
LVL 35

Expert Comment

by:Norie
ID: 36903219
The ORs are missing a cell reference.

Even if it's the same cell you are checking you still need that.

This,

OR(A1="FIJ","FIT")

should be this,

OR(A1="FIJ",A1="FIT")

That'll get rid of the #VALUE! error, don't know about the logic.:)
0
 
LVL 59

Expert Comment

by:Saurabh Singh Teotia
ID: 36903220

Use this formula...

=IF(OR(A1="FIT",A1="AIJ"),IF(J1="BUY",O1,O1*-1),IF(A1="SIT",IF(J1="Buy",O1*-1,O1),""))

Saurabh..
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 2000 total points
ID: 36903268
=IF(A1="SIT",IF(J1="BUY",O1*-1,IF(J1="SEL",O1,"")),IF(OR(A1={"FIJ","FIT"}),IF(J1="Buy",O1,IF(J1="SEL",O1*-1,"")),""))

or if you can assume that J is always BUY or SEL then:

=IF(A1="SIT",IF(J1="BUY",O1*-1,O1),IF(OR(A1={"FIJ","FIT"}),IF(J1="Buy",O1,O1*-1),""))
0
 

Author Closing Comment

by:Seamus2626
ID: 36903376
Rory squared up the logic as well as the formula, thank you all for suggestions.

Thanks
Seamus
0
 
LVL 35

Expert Comment

by:Norie
ID: 36903384
=IF(OR((A1="SIT")*(J1="BUY"), AND(OR(A1={"FIT","FIJ"}), J1="SEL")),-O1,O1)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question