What’s the difference between a while (two words) and awhile (one)? Here’s the rule: A while is an article and a noun and normally comes after the preposition for. When you use two words, you’re going to use a noun and refer to a period of time.
Example: It has been a while since I saw you. You could substitute another article-noun, such as a month: It’s been a month since I saw you. If that makes sense, you’ve made the correct choice.
Awhile (one word) is an adverb and means “for a short time.” Go dance for awhile—that is, dance for a few minutes.
This bothered me for years, until I figured out that a while is a noun phrase.