Okay, how about something more like this:
awk "/^[A-Z]\$/{ l=\$1 ; } ; /^${NAME}\$/ { print l ; exit ; };"
Cons: Involves quoting (which I personally try to avoid) and regexes (which are hard to understand) and awk (which is hard to understand)
Pros: I think this does the trick, at least as I understand it revisedly.
(it may not go without saying that you should replace ${NAME} with the entry that you're searching for, e.g. tim)
The explanation that was requested in the comments section:
/^[A-Z]\$/{ l=\$1 ; }
For each line that is a single capital letter, assign the first (only) item on that line to the variable l (letter ell).
/^${NAME}\$/ { print l ; exit ; }
For each line that matches ${NAME} (you should substitute the thing you're looking for for ${NAME}, as I said above, or set and export the NAME environment variable before running the command), print the most recent value for the variable l, and then exit. Effectively, the program exits as soon as it encounters a line that is exactly the value specified, right after printing the most recently encountered line matching the first regular expression.
I quoted all of the $'s other than the one used for ${NAME} because I used double-quotes instead of single-quotes (to permit ${NAME} to expand, but to avoid messing with the other $'s.