if {GetRepo_StockAsdate;1.CostPr}=0 then
100
else
(({GetRepo_StockAsdate;1.SellPr}-{GetRepo_StockAsdate;1.CostPr})/{GetRepo_StockAsdate;1.SellPr})*100
If I am interpreting your question correct, you are getting a divide by zero error in crystal. This is because in your code you are checking if the dividend is 0, not the divisor.
if {GetRepo_StockAsdate;1.SellPr}=0 // divisor
then
// dont divide
else
// divide