i need to do a condition that:

if cell a=b=c=d then i want it to merge the 4 cells in 1 cell with the value of a
and if not, to keep them as they are, how can i do it?
help plz