Custom Validation to check values of fields

Is there a way to add custom validation to check if value of one field doesn’t exceed value of other field

You can have workflow to check it.

but i won’t be able to stop saving or display error messages

oh yeah! Maybe you need to add custom code for the field. I do not know how to do it. Could you please check in this forum about it?