It is difficult to understand your question without seeing the code that you have.
If it will help, in this tutorial http://www.excelforum.com/tips-and-t...uild-udfs.html :
function quadratic(a as double, b as double, c as double)
stop
disc=b^2-4*a*c
if disc<0 or a=0 then
quadratic="error"
exit function
end if
quadratic=disc
end function
This is one of the intermediate stages and shows how I might handle the "error" when the discriminant for the quadratic equation is negative (seems like a very similar problem to what you describe here).
Bookmarks