WOLFRAM

Products
  • Wolfram|One
  • Mathematica
  • Wolfram Notebook Assistant + LLM Kit
  • Wolfram|Alpha Notebook Edition
  • System Modeler
  • All Products
Consulting & Solutions
  • Wolfram Consulting
  • Industry Solutions
  • Solutions for Education
Learning & Support
  • Wolfram U Courses
  • Wolfram Language Resources
  • Wolfram Community
  • Support FAQs
  • Contact Support
Company
  • About Wolfram
  • Careers
  • Events
  • Educational Programs
  • All Sites and Resources
Wolfram|Alpha
Wolfram Cloud
Your Account
  • Your Account
  • User Portal
Search

Working in Mathematica  / Creating Excel Functions  /
Previous section-----Next section

Special Considerations

Usage

To help others know how to use your function, you can define a usage message.

In[8]:=
Out[8]=

The usage message is used by the Mathematica Function Wizard to automatically generate argument templates for the function. To be fully compatible with the Function Wizard, you should always use the following convention for your usage messages.

In[9]:=
Out[9]=

Options

You can also define a set of default options for your functions, if needed.

In[10]:=
Out[10]=

This clears the previous definition for the function, then defines it with options.

In[11]:=
In[12]:=
In[13]:=

Errors

When you are developing a function that will be used in Excel, you should consider returning the symbol $Failed if something goes wrong in your function. You can do this using the Check function.

In[14]:=

The symbol $Failed is converted to a #VALUE! error in Excel that will suppress further dependent calculations.

In[15]:=
Out[15]=

To be complete, you should also create a catch-all function definition that will handle the case where users provide arguments that do not match the pattern you specified. By default, the function returns unevaluated.

In[16]:=
Out[16]=

This traps the error.

In[17]:=
In[18]:=
Out[18]=

You can also create your own error messages to inform the user about what went wrong.

In[19]:=
In[20]:=
Out[20]=
In[21]:=
Out[21]=


  • Products
  • Wolfram|One
  • Mathematica
  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps
  • Finance Platform
  • System Modeler
  • Wolfram Player
  • Wolfram Engine
  • WolframScript
  • Wolfram Workbench
  • Volume & Site Licensing
  • Enterprise Private Cloud
  • Application Server
  • View all...
  • Services
  • Technical Consulting
  • Corporate Consulting
  • For Customers
  • Online Store
  • Product Registration
  • Product Downloads
  • Service Plans Benefits
  • User Portal
  • Your Account
  • Support
  • Support FAQ
  • Customer Service
  • Contact Support
  • Learning
  • Wolfram Language Documentation
  • Wolfram Language Introductory Book
  • Get Started with Wolfram
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Webinars & Training
  • Wolfram U
  • Summer Programs
  • Videos
  • Books
  • Public Resources
  • Wolfram|Alpha
  • Demonstrations Project
  • Resource System
  • Connected Devices Project
  • Wolfram Data Drop
  • Wolfram + Raspberry Pi
  • Wolfram Science
  • Computer-Based Math
  • MathWorld
  • Hackathons
  • Computational Thinking
  • View all...
  • Company
  • Events
  • About Wolfram
  • Careers
  • Contact
  • Connect
  • Wolfram Community
  • Wolfram Blog
  • Newsletter
© 2025 Wolfram
  • Legal & Privacy Policy
  • Site Map
  • WolframAlpha.com
  • WolframCloud.com