THis is obviously a very simplistic example, and, with 6 possible letters, could probably be done with index and 6 nested iferror/matches, but I have a feeling you have far more than 6 - which makes that options impractical.

What exactly are you trying to do here, and can you give a more realistic example?