After generating random characters using this command given by a member of
this discussion group:

=MID(A1,5+INT(RAND()*LEN(A1)),5),

how do I correct the following outputs?

(1) How can I make sure that the characters generated are not repeated in
any of the cells?

(2) Some cells returns null characters while some others return characters
whose length is less than the specified length in LEN (5 in this case). How
can I control the length of characters the code will return?