Solved

ERROR.TYPE  and Choose alternative solution

Posted on 2014-10-13
8
115 Views
Last Modified: 2014-10-13
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
Comment
Question by:ProfessorJimJam
  • 3
  • 3
  • 2
8 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
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 32

Expert Comment

by:Rob Henson
ID: 40377077
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.
0
 
LVL 32

Accepted Solution

by:
Rob Henson earned 170 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 25

Author Comment

by:ProfessorJimJam
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 49

Expert Comment

by:Rgonzo1971
ID: 40377153
Hi,

see example in A9
ERROR.TYPEv1.xlsm
0
 
LVL 25

Author Comment

by:ProfessorJimJam
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 49

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 330 total points
ID: 40377435
Hi,

then try

Function myFunc(rng As Range) As String
myFunc = Evaluate("IFERROR(" & rng.Address & ",CHOOSE(ERROR.TYPE(" & rng.Address & _
    "),""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 25

Author Closing Comment

by:ProfessorJimJam
ID: 40377687
Thank you both.

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

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now