Link to home
Start Free TrialLog in
Avatar of Professor J
Professor J

asked on

ERROR.TYPE and Choose alternative solution

Excelers,

please see attached file. with help of Rgonzo1971. i have the formula combined with choose to tell the users more meaningful explanation of errors in cells.

now, the end users of my excel files are novice excel users and too long formula confuses them, i wanted somehow to convert replacing it with a simple UDF that would be shorter to be used in formulas.

thanks.
ERROR.TYPE.xlsx
Avatar of Rgonzo1971
Rgonzo1971

Hi,

pls try

Function myFunc(frml As String) As String
myFunc = Evaluate("IFERROR(" & frml & ",CHOOSE(ERROR.TYPE(" & frml & "),""No Intersection"",""Divided by Zero"",""Invalid operand Or Argument type"",""Cell reference Deleted"",""Name Deleted Or Incorrect Name"",""Invalid numeric values Or number is too big"",""Not Available Or No Answer""))")

End Function

in Excel =myFunc("25/0")

Regards
Would your users understand a lookup table instead?

Rather than using CHOOSE within the formula, maybe you could do a lookup for the error type.
ASKER CERTIFIED SOLUTION
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Professor J

ASKER

thank you Rgonzo1971

it gives #Value Error.  does not work.


besides

the vba line is all in one long line, can it be wrapped in different lines like the VBA continuation symbol _
Hi,

see example in A9
ERROR.TYPEv1.xlsm
Rgonzo1971

please see attached.  you used it by putting a string in double quote, i need to give it a cell reference, please see attached. the UDF does not work.
ERROR.TYPEv1.xlsm
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you both.

i also liked the idea of Vlookup from Rob too.