a while is an
indefinite period of time. It is usually equivalent to
some time. It can be short or long; it is relative to the context in which it occurs.
For example, the amount of time represented by while in I'll be in Europe for a while is greater than the amount of time represented by while in I'll be in the kitchen for a while.
_______________
for measures the amount of time that passes while an action is taking place. The action can be continuous, repetitive, or habitual.
The neighbors go jogging for [thirty minutes / an hour / a while] every day.
I walked in the park for [an hour / two hours / a while].
Marcy worked at Amerigenco for [two months / a year / a while].
As part of the research for his new book, Donald had to travel between Asia and Africa for [many years / a while].
________________
in measures the amount of time that will pass between the present time and the time of the action.
I'll be going to the park in [two days / a while].
So these two mean entirely different things:
I'm going to the bank for a while. / I'm going to the bank in a while.
The first says how long I will be at the bank. The second tells when I will start out to go to the bank.
You can even use both in one sentence: In a while I'll be going to the bank for a while. But it sounds awkward, so people don't normally use both like this.
Here's another similar group:
I'm going to Japan for a week. / I'm going to Japan in a week. / I'm going to Japan for a week in a week. / In a week I'm going to Japan for a week.
________
With negative statements in the perfect tenses, you have a choice.
in can be chosen if you think of measuring the amount of time between the action (when it last took place) and the present moment. for can be chosen if you think of measuring the amount of time during which the 'non-action' took place. In this context, for does not tell how long the action lasted, but how long the absence of the action lasted. I believe that the usual choice is in, but you will hear both.
I have not gone to the bank in/for [two weeks / three days / a while].
I haven't been to Japan in/for [several years / a while].
Gregory hadn't seen that film in/for [many years / months / a while].
______
The use of these expressions with the affirmative perfect tenses is unidiomatic, although it is somewhat less objectionable with for, where for can revert back to its meaning as a measure of how long the action was in progress.
I've been to Italy *in/?for [a year / a while].
Joe has been playing tennis *in/?for [three hours / a while]. (In the reading of one session of tennis playing)
Joe has been playing tennis *in/for [years / a while]. (In the reading of a lifetime of practicing the sport of tennis)
CJ