Solved

IF OR AND Statements - EXCEL

Posted on 2016-08-26
7
49 Views
Last Modified: 2016-08-29
I have the column below

Payment terms
60
45
30
35

I want to add a column with an if statement that will return new values based on the following conditions

If column "payment terms" contains values 45 or 30 or 35 then return 30 and if it contains 60 then return "58"

Mike
0
Comment
Question by:mikes6058
  • 3
  • 2
  • 2
7 Comments
 
LVL 32

Accepted Solution

by:
Rob Henson earned 250 total points
ID: 41771556
Assuming Payment Terms in column A:

=IF(OR(A1=45,A1=35,A1=30),30,58)

Thanks
Rob
0
 
LVL 49

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 250 total points
ID: 41771577
Hi,

Maybe
=IF(OR(A1=45,A1=35,A1=30),30,IF(A1=60,58,""))

Open in new window

Regards
0
 

Author Comment

by:mikes6058
ID: 41771578
Thanks Rob,

How would it look if I added another value re below.

Payment terms
60
65
45
30
35

I want to add a column with an if statement that will return new values based on the following conditions

If column "payment terms" contains values 45 or 30 or 35 then return 30 and if it contains 60 or 65 then return "58"

Mike
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 49

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 250 total points
ID: 41771581
then try

=IF(OR(A1=45,A1=35,A1=30),30,IF(OR(A1=60,A1=65),58,""))

Open in new window

0
 
LVL 32

Assisted Solution

by:Rob Henson
Rob Henson earned 250 total points
ID: 41771582
With my formula, entries of 45, 30 or 35 will return 30, anything else will return 58.

I notice the values are incremental, is there a point at which the value of the entry will trigger the change, eg less than 60 returns 30, 60 or greater returns 58.

If you have multiple thresholds it may be easier to do it with a lookup table.
0
 

Author Comment

by:mikes6058
ID: 41771618
Thanks Rgonzo,

Do you know how I would write this formula using  a calculated column in a power pivot data model? I thought I would be able to use the same formula but I'm getting an error

Mike
0
 
LVL 49

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 250 total points
ID: 41771626
if I remember well DAX's Or only accepts two arguments

so you could try something like this

=IF(A1<=45,30,IF(A1<=65,58,""))
or
=IF(A1<=45,30,58)

if you want multiple "Ors" use operator ||
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now