WOLFRAM

Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • Compute Services
  • 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
  • Notebook Assistant + LLM Kit
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Facebook X Twitch LinkedIn YouTube Wolfram
© 2025 Wolfram | Legal & Privacy Policy |
English
  • en