The word affect is used as a verb, always, while effect is generally used as a noun. Thus,
- He was affected by her presence.
- Her presence had an effect on him.
We have used affect, the verb form, in the first sentence; while in the latter one we have employed the noun, that is, effect.
That said, I would ask you to hark back to the beginning of my answer, in which I mentioned that effect is *generally* used as a noun. What that means is that although the most common use case of effect is that of a noun, it can also be used as a verb. As a verb, effect would mean to cause something to happen. On the other hand, affect would generally imply a consequence of that cause. Examples below.
- The generals effected a revolt against the king.
- The citizens were greatly affected by the revolt.
In the first sentence, effect as a verb means that the generals caused a revolt to happen. In the latter case, we learn of its unfortunate consequences on the citizens of the kingdom.