A simple UDF will return #Value and another cell will see this as isError() = True
All good.
But I want to tell the user 'WHY' there was an error and the basis ones (DIV0, REF etc) are insufficient.
I need to return 'something' so the user knows why the error occured like 'invalid zip code format' or something.
I though of returning ExcelError.ExcelErrorValue and ALSO writing to the cells 'Note' attribute ... but maybe there's a better way.
I saw something on MSFT web site about a CustomError class but it only seemed to be supported in TypeScript.
[ExcelFunction(Category = "Test",Description = "Force an error")]
public static object ForceError(String pText)
{
if (pText == "No") return "No Error";
// need to provide some way to tell the user WHY other than #Value!
return ExcelError.ExcelErrorValue;
}