I used to get awesome headaches -- and "awesome" is putting it mildly -- from skipping a cup of coffee after having one or two the previous day. Then I discovered that Exedrin won't allow the headache to happen if you take it around the same time that you had coffee on the previous day. For good measure I took an Exedrin at the same time on the next day as well.
Nowadays I drink Green Tea. I have a cup in the morning and one at noon, but any kind of caffiene product will not let me sleep well if I take it after 4 p.m.
Frank