"... it still gives an error" isn't very specific. You haven't told us what
formula you are using, so we can't tell you what you've done wrong.
If instead of =(E34-D34)/E34 you wanted to start from =(J37-C37)/ABS(C37),
then instead of
=IF(E34-D34=0,0,IF(E34=0,"infinite % difference",(E34-D34)/E34))
you would end up with
=IF(J37-C37=0,0,IF(C37=0,"infinite % difference",(J37-C37)/ABS(C37)))
If you want the result as a percentage, format the cell with a percentage
format to suit your requirements.
Is that the formula you were using? If so, what input values did you have
in J37 and C37, what result did you get, and what result did you expect?