JohnMc,
Please see attached excel file that will check for your conditions. I'm not 100% sure what you mean by error message, an error message is a static message that informs the user of something. An alternative would be to prompt the user for an action (i.e. to confirm data entry that violates expected conditions) this way you can guarantee your data is valid.
Hope this helps,
Dave