In this case H18 is "almost" 0

Try

=IF(round(H18,2)= 0,0,D18/H18)