Suppose a person possess rice and wants to exchange it for wheat. Under the barter system he had to find out a person who not had wheat but also wants rice. But such a double coincidence was a rare-possibility. With the use of money, all the commodities can be easily exchanged and you do not need double coincidence of wants.