There are two things we know about the relative usage of AN and A:
1. We use AN before a vowel
2. A word uses AN or uses A no matter where in the world you are, it never changes.
…well, no and no!
Here is a a quick 5 point novel guide to AN vs. A.
1. What exactly is the rule for using AN?
The rule is that you use AN before a vowel sound. So, even though, hour begins with a consonant it possesses a vowel sound so we say an hour.
2. What exactly is the rule for using A?
The rule is that you use A before a consonant sound. So, even though, Eucalyptus begins with a vowel it possesses a consonant sound so we say a Eucalyptus tree.
3. Watch out for some troublesome consonants like h and m
Though, a hermit, he was always an honorable man.
I have a Masters in Business Administration or all so know as an MBA
4. Watch out for some troublesome consonants like o and u
You can use an umbrella at a university.
It was an open field in the 400 meters, a one lap race
5. Watch out for accents
AN and A are driven by the consonant sound or the vowel sound and so an accent can potentially change the use of AN and A. Rosemary is an erb in North America and a herb in England (even Microsoft spell checker thinks it is an erb.)