Solved

IF OR AND Statements - EXCEL

Posted on 2016-08-26
7
62 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 33

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 50

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 50

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 33

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 50

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
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.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

730 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