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 Macros  /
Previous section-----Next section

Developing Macros

Setting Up a New Notebook

When developing Mathematica code, it is best to separate input and output definitions from the main analysis portion of the routine. This way your analysis code can be easily adapted to obtain inputs and send outputs anywhere.

Here is a sequence of Mathematica commands that performs some analysis.

This section defines inputs.

This section performs your analysis.

This section displays outputs.

To use this code as an Excel macro, you only need to load the ExcelLink package to modify the input and output sections. Before doing this, open Excel and type in the same inputs into the workbook locations indicated in the following.

This section loads required packages.

This section defines inputs from Excel.

This section performs your analysis.

This section returns outputs to Excel.

In this example, the input and output range is the same. This is a way of performing in-place evaluation.

Modifying an Existing Notebook

To convert an existing Mathematica notebook to be used as an Excel macro:

• Locate the cells in your notebook that define inputs to your analysis.
• Modify those cells to use values contained in Excel.
• Likewise, locate the cells in the notebook that display outputs of your analysis.
• Modify those cells to return results to Excel.

For more information, see Code Box Deployment.



  • 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