What's your question?
You haven't supplied any information. I can see how your columns B & C have the letters in Column A but column D does not make any sense.

Can you explain the logic in this? You say you have a formula, what is it?