Is he sinning if he is not able to advise someone who has done something wrong?
Question

I was in the mosque and I saw something wrong, but I was not able to advise this person, as there were many people there and that person left quickly. When I thought I had the opportunity to speak to him, someone stopped me and greeted me, and I was not able to advise that person. Is there any sin on me? If that is the case, how can I expiate my sin?
Praise be to Allah.First of all, we congratulate you on your keenness to fulful the duty of advising your Muslim brothers and to do the religious duty of enjoining what is right and forbidding what is wrong. This is one of the most important religious duties about which many people have become heedless. It is one of the characteristics and merits for which Allah praises His slaves, and He has made it a symbol of goodness. Allah, may He be exalted, says (interpretation of the meaning):
{You are the best nation produced [as an example] for mankind. You enjoin what is right and forbid what is wrong and believe in Allah} [Al ‘Imran 3:110].
Ibn Kathir (may Allah have mercy on him) said: What is meant is: You are the best of nations and the most beneficial to people. Hence He says: { You enjoin what is right and forbid what is wrong and believe in Allah}.… A man went to the Prophet (blessings and peace of Allah be upon him) when he was on the minbar and said: O Messenger of Allah, who among the people is best? He said: “The best of the people are those who have most knowledge of Qur’an and are most mindful of Allah, and who enjoin people to do what is right and forbid them to do what is wrong, and are the most assiduous in upholding ties of kinship."(Tafsir Ibn Kathir  2/93).
It was narrated that Abu Sa‘id al-Khudri said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “Whoever among you sees an evil action, let him change it with his hand (by taking action); if he cannot, then with his tongue (by speaking out); and if he cannot, then with his heart (by hating it and feeling it is wrong), and that is the weakest of faith.” Narrated by Muslim (49).
An-Nawawi (may Allah have mercy on him) said: Regarding the words “let him change it,” this is an instruction in the sense of it being obligatory, according to the consensus of the ummah. It is obligatory to enjoin what is right and forbid what is wrong, according to the Qur’an, the Sunnah and the consensus of the ummah. This also comes under the heading of sincerity (nasihah), which is the religion."(Sharh Sahih Muslim  2/22).
With regard to your being unable to catch up with the person whom you wanted to advise, there is no sin on you, because that did not happen due to any shortcoming on your part; rather it was because of something that happened and prevented you from catching up with the person in question.
Undoubtedly obligations depend on being able to do them. If someone wants to do good, then is prevented from doing it, there is no blame on him for that. One of the established principles of Islamic teachings is that there is no obligation when one is unable to do it.
Allah, may He be exalted, says (interpretation of the meaning): {Our Lord, do not impose blame upon us if we have forgotten or erred. Our Lord, and lay not upon us a burden like that which You laid upon those before us. Our Lord, and burden us not with that which we have no ability to bear. And pardon us; and forgive us; and have mercy upon us. You are our protector, so give us victory over the disbelieving people} [al-Baqarah 2:286].
In Sahih Muslim it says that Allah, may He be exalted, said: “I have granted that.”
It is the way of Allah, may He be glorified, that He does not burden anyone with more than he can bear.
Ash-Shatibi (may Allah have mercy on him) said: It is proven in the books of usul that the condition of being accountable, or the reason for being accountable, is that the accountable person should be able to do what is enjoined. So whatever he is unable to do cannot be required of him, according to Islamic teachings."(Al-Muwafaqat  2/171).
There is also the hope of reward for your intention. It was narrated from Anas ibn Malik (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) came back from the campaign to Tabuk and when he drew close to Madinah he said: “In Madinah there are people who, whenever you travelled any distance or crossed any valley, were with you.” They said: O Messenger of Allah, even though they are in Madinah? He said: “Even though they are in Madinah, because they were kept there by valid excuses.”  Narrated by al-Bukhari (4423).
And Allah knows best.