If both the transactions are linked together then the deposit you get on your sale can be used on your purchase provided the figures are agreed on both sides.
You can exchange and complete both on the same day but this is unlikely as most people like to exchange earlier to get people tied in and have a certain moving date for completion and to organise everything.