Simple Code Help

rwe1187

New Member
Joined
Jun 1, 2021
Messages
34
Office Version
  1. 365
Platform
  1. Windows
I cannot believe I cant figure this out.. I need a simple code that will pop up a warning box when 2 values in 2 different cells do not equal a set of values. For instance, if a user puts c/o in cell c2 then the calue in e2 must be 0. If anything other than 0 when the c2 value is c/o an error must pop up. But, if the user places c/o in c2 and 0 in e2 then just accept the 0 and move forward.

Thank you.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I think you're looking for Data Validation for E2 as: =AND(C2="c/o",E2=0)
 
Upvote 0
I think you're looking for Data Validation for E2 as: =AND(C2="c/o",E2=0)
I knew someone would get it fast. Now if I wanted to make the "c/o" cell either "c/o" or "off" how would that look?

Thanks for the help.
 
Upvote 0
How about:
Code:
=AND(OR(C2="off",C2="c/o"),E2=0)
 
Upvote 0
Restate the conditions that are valid and those that aren't.
 
Upvote 0
Maybe it's this:

Code:
=IF(AND(OR("off"=C2,"c/o"=C2),0<>E2),0,1)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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