IF OR AND Statements - EXCEL

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
mikes6058Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rob HensonFinance AnalystCommented:
Assuming Payment Terms in column A:

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

Thanks
Rob
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rgonzo1971Commented:
Hi,

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

Open in new window

Regards
0
mikes6058Author Commented:
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Rgonzo1971Commented:
then try

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

Open in new window

0
Rob HensonFinance AnalystCommented:
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
mikes6058Author Commented:
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
Rgonzo1971Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.