Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# ERROR.TYPE  and Choose alternative solution

Posted on 2014-10-13
Medium Priority
128 Views
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
0
Question by:ProfessorJimJam
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3
• 3
• 2

LVL 52

Expert Comment

ID: 40377069
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
0

LVL 33

Expert Comment

ID: 40377077

Rather than using CHOOSE within the formula, maybe you could do a lookup for the error type.
0

LVL 33

Accepted Solution

Rob Henson earned 680 total points
ID: 40377096
You would then have the following in a table:

1      No Intersection
2      Divided by Zero
3      Invalid operand Or Argument type
4      Cell reference Deleted
5      Name Deleted Or Incorrect Name
6      Invalid numeric values Or number is too big
7      Not Available Or No Answer

and a formula:

=VLOOKUP(ERROR.TYPE(C1),\$A\$11:\$B\$17,2,FALSE)

A11:B17 referring to table above.

Thanks,
Rob H
0

LVL 27

Author Comment

ID: 40377114
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 _
0

LVL 52

Expert Comment

ID: 40377153
Hi,

see example in A9
ERROR.TYPEv1.xlsm
0

LVL 27

Author Comment

ID: 40377181
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
0

LVL 52

Assisted Solution

Rgonzo1971 earned 1320 total points
ID: 40377435
Hi,

then try

Function myFunc(rng As Range) As String
"),""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

Regards
ERROR.TYPEv2.xlsm
0

LVL 27

Author Closing Comment

ID: 40377687
Thank you both.

i also liked the idea of Vlookup from Rob too.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will diâ€¦
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to usâ€¦
###### Suggested Courses
Course of the Month6 days, 14 hours left to enroll