These two words trip up even experienced writers, mostly because they sound alike but play different grammatical roles.
A verb meaning to influence or change something.
A noun meaning the result or outcome of a change.
The two words sound almost the same in quick speech, they share a root, and both are about one thing changing another. The difference is grammatical. In everyday writing, affect is the action and effect is the result: the rain affected the match, and the rain had an effect on the match.
The confusion survives because each word has a second, rarer use that runs the other way. Effect can be a verb meaning to bring something about, as in a new manager who effected sweeping changes, which means she made them happen, not that she influenced them. Affect can be a noun in psychology and medicine, where a patient's affect is the emotion they visibly show, as in a flat affect. Outside those two cases, the everyday rule holds.
If you can put the word "the" in front of it, you almost certainly want effect. If it describes something doing something to something else, you want affect.
The new schedule will effect everyone on the night shift.
✓The new schedule will affect everyone on the night shift.
The schedule is acting on people, so this is the verb: affect.
The medication had no noticeable affect.
✓The medication had no noticeable effect.
After "no noticeable" you need a thing, a result, so the noun effect.
We want to affect real change in the neighborhood.
✓We want to effect real change in the neighborhood.
If you mean bring the change about, it is the rarer verb, effect. "Affect change" would mean influencing a change that is already happening.
Quick way to remember
If you can replace it with "influence," you want "affect." If you can replace it with "result," you want "effect."
Is it "affected by" or "effected by"?
Almost always affected by: "the town was badly affected by the flood." Effected by would mean the flood brought the town into being, which is rarely what anyone means.
Which word goes in "take effect" and "in effect"?
Effect, in both. "The rule takes effect on Monday" and "the rule is in effect" are both about a result, so they use the noun.