Try this instead.
Formula: copy to clipboard
=LOOKUP(1E+306,--CHOOSE({1,2,3,4},ISERROR(AG82/AH82),(AG82/AH82)=0,ERROR.TYPE(AG82/AH82),AG82/AH82))
If your are not aware of it the number(s) in ERROR.TYPE are what the function returns when wrapped around an equation.

If what you expect is 7 then enter it as a constant like this.
Formula: copy to clipboard
=LOOKUP(1E+306,--CHOOSE({1,2,3,4},ISERROR(AG82/AH82),(AG82/AH82)=0,7,AG82/AH82))