I have a table on "Sheet2" where you input a letter and state where it goes in "Sheet1"; A1, A2, A3 etc. in the first column and the letter goes in the second column. This table accepts duplicates and would look like this:

A1 Z
A2 Z
A3 X
A1 X
A2 X

I would like this to display:

In column A. What I initially did was make a macro to sort the data where the highest priority is at the top and would replace it once it's sorted but this is inefficient since macros take a bit of time to run. The problem is that the formula to display the letter in A1, A2 and A3 is in those same cells, therefore trying to create a condition results in a circular reference. I hope I'm clear on what I'm asking for.