Given when some text in a certain cell equals something Conditional Formatting may be much simpler. onEdit would be required if the change is from 'any value' to 'any other value' (so potentially from y to x as well from x to y) but CF can be triggered in cases such as:
"from less than 100 to 100 (or to 100 or more than 100), etc.",
"from Pending to Complete (or to any member of a list such as Abandoned, Transferred, Rescheduled, etc.)",
"from more than a year left to less than a month (or a week, or 4 days, etc.)",
"from any one of Red, Orange, Yellow to Green or Blue (or either Indigo or Violet, etc.),
"from being a unique entry in a list to being a duplicate (ie without changing its own value becomes equal to any other entry)