Excel formula to return value based on certain criteria

Ekguy41

New Member
Joined
Jul 29, 2016
Messages
12
Office Version
  1. 2016
Hello,

I am using excel 2016 and trying to create ta formula that will return a certain value based on multiple criteria. I have set out the logic below but everything I try doesn’t work :mad:

if(and(a1=“Green”,a2<>”-“),”Good”,”Bad”
if(and(a1=“Amber”,a2<>”-“),”Good”,”Bad”
if(and(a1=“Red”,a2 <>”-“),,”Good”,”Bad”
if(and(a1=“-“,”-“),”Bad”
if(and(a1=“-“,a2<>”-“),”Bad”

any help or a better way to write the formula would be greatly appreciated. Been at this one for a couple of days.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hello,

I am using excel 2016 and trying to create ta formula that will return a certain value based on multiple criteria. I have set out the logic below but everything I try doesn’t work :mad:

if(and(a1=“Green”,a2<>”-“),”Good”,”Bad”
if(and(a1=“Amber”,a2<>”-“),”Good”,”Bad”
if(and(a1=“Red”,a2 <>”-“),,”Good”,”Bad”
if(and(a1=“-“,”-“),”Bad”
if(and(a1=“-“,a2<>”-“),”Bad”

any help or a better way to write the formula would be greatly appreciated. Been at this one for a couple of days.
Last two lines should read a2=“-“ and a2<>”-“
 
Upvote 0
I am using excel 2016
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=IF(A2="-","bad",IF(OR(A1={"Green","Amber","Red"}),"good","bad"))
 
Upvote 0
Thanks for your response. I have updated my profile.

the formula is nearly there I just need to one more part that says if a1 = green and a2 =“-“ then good
 
Upvote 0
How about
Excel Formula:
=IF(A2="Green","good",IF(A2="-","bad",IF(OR(A1={"Amber","Red"}),"good","bad")))
 
Upvote 0
Thank you it’s near perfect. Only issue is if a1=green and a2 <> - the that should be bad and if a1=- and a2 <> - the that should be bad as well. Everything else works perfectly
 
Upvote 0
Apologies, I have listed the correct scenario below
if a1 = green and a2 = - then good
if a1 = green and a2 <> - then bad
if a1 = amber and a2 = - then bad
if a1 = amber and a2 <> - then good
if a1 = red and a2 = - then bad
if a1 = red and a2 <> - then good
if a1 = - and a2 = - then bad
if a1 = - and a2 <> - then bad
 
Upvote 0
Ok, how about
Excel Formula:
=IF(A2="-",IF(A1="green","good","bad"),IF(OR(A1={"amber","red"}),"good","bad"))
 
Upvote 0
Thank you so much!!! It works perfectly. I really do appreciate you giving me your time and help.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top