There is a MUCH simpler method that works for the sharp keys. Whatever the right-most sharp is, go up a half step and that's your key. For example, if there are 3 sharps in the key signature, they go in order: F#, C#, G#. The next note up from G# is A, so 3 sharps = key of A.
This rule even works when there are 6 sharps and the rightmost one is E#, because a half-step up from E# is F# Major.
Flat keys are even easier. Just look at the flat that is 2nd from last. If there are 4 flats, they are Bb, Eb, Ab, Db. Key of Ab Major!, simple!
And of course for minor keys, always count down 3 half-steps (minor 3rd) from that.
Does this work with Tabs?