All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
In principle it is better to sacrifice than to give money in charity. If you can join sacrificing with giving charity then do so, otherwise it is better to give the money in charity if there is a greater benefit. You are not obliged to buy the sacrifice with this money just because you initially intended to do so.
Allaah knows best.