I am needing help trying to figure out a formula to delete extra information.

If Column A has a cart number followed by an "S" and Column C says "YARD" then Column G should equal "GC". If Column G does NOT equal GC then delete the row.

Also, if Column A has a cart number follows by an "S" and Column C says "SALE" then Column G should equal "TR". If Column G does not equal TR the delete the row.

Any suggestions on formulas and how would I implement this? Is it a macro or a conditional format?

Thank you in advance.