How to Create a Calculator Using Macros in Excel (with Easy Steps)

You could be a businessman, a student, or anything else. Every day, you require a simple calculator. Although Excel itself is a complete calculator, we can create a basic calculator capable of doing addition or subtraction like basic operations in Excel. In this article, we’ll demonstrate four easy and quick steps to create a calculator using macros in Excel. So, let’s go through the entire article to understand the topic properly.

How to Create a Calculator Using Macros in Excel (with Easy Steps)

In the following article, we’ll exhibit four easy and practically detailed steps to create a calculator using macros in Excel. With this calculator, you can easily do multiple operations like addition, subtraction, multiplication, and division. See a demo in the following GIF.

how to create a calculator in excel using macros

So, without further delay, let’s explore the method step by step. Let’s start!!
Here, we have used the Microsoft Excel 365 version; you may use any other version according to your convenience.

Step 01: Record Macro

In our first step, we’ll record the necessary macros to create the calculator in Excel. It’s a fascinating and entertaining technique for new ones. It’s simple and easy; just follow along.

📌 Steps:

  • At the very beginning, create a basic outline like the following image. We constructed two Input cells in cells C4 and C5. On the other hand, you can see an Output cell in cell C10.

Record Macro

  • Now, give some dummy values in cells C4 and C5.
  • Following this, go to the Developer tab. If the Developer tab isn’t available on the ribbon, go through the article, How to show Developer Tab in Excel on our website to get it done.
  • Then, click on Record Macro on the Code group of commands.

Record Macros to create calculator in Excel

Immediately, the Record Macro dialog box will appear before us.

  • In the Macro name box, write down Addition.
  • After that, click OK.

Working on Record Macros dialog box in Excel

Now, Excel will record whatever we do in the worksheet.

  • So, select cell C10 and enter the following formula in that cell.
  • After that, press the ENTER key.
  • Then, click on the Stop button on the left-bottom corner of the display to stop recording the macro.

So, it’s a simple macro to do the addition operation.

Step 02: Copy Code for Various Operations

We can see the VBA code of this macro easily. So, let’s see it in action.

📌 Steps:

  • Again, proceed to the Developer tab.
  • Afterward, click on Macros on the Code group.

Copy Code for Various Operations

Instantly, the Macro dialog box will pop up.

Here, we can see the Addition macro, which we created just a little bit ago.

  • Therefore, select this macro.
  • Following this, click on the Edit button.

Macros dialog box in Excel

Right away, it’ll take us to the Microsoft Visual Basic for Applications window. We can see the relevant codes here.

Microsoft Visual Basic for Applications window

So, it’s the code for the addition operation. Now, we’ll copy this sub-procedure to create macros for other operations like subtraction, multiplication, and division.

  • Momentarily, copy the code and paste it down thrice.
  • Just change the operator from (+) to () for subtraction, to (*) for multiplication, and to (/) for division.

kinda similar code for different operations in Excel

Presently, we opt to create 2 dedicated macros for deleting contents from the cells.

  • Similarly, bring the Record Macro dialog box.
  • Then, write down Clear_Output as the Macro name.
  • Also, click OK.

Now, the macro is recording. Do the following steps.

  • At first, select cell C10.
  • Then, navigate to the Home tab.
  • After that, click on the Clear drop-down icon.
  • From the drop-down list, select Clear Contents.
  • Later, tap on the Stop button on the Status Bar.

Clear Contents in Excel

Equivalently, you can see the VBA code for this macro.

  • In addition, we created a different macro to Clear_All.

Macros for clear all in Excel

With this macro, we can delete the contents in cells C4, C5, and C10.

Step 03: Insert Button from Form Controls

In this step, we’ll insert some buttons to control these macros. So, without further delay, let’s dive in!

📌 Steps:

  • First of all, advance to the Developer tab.
  • Secondly, click on the Insert drop-down icon.
  • Thirdly, choose Button (Form Control) from the available options.

Insert Button

  • After that, place a button like an image below.

Inserting button in Excel

  • At this moment, right-click on the button.
  • From the context menu, click on the Edit Text option.

Editing button caption in Excel

That’s how you could change the button caption. We created this button for Addition.

insert button to create a calculator using macros in Excel

Step 04: Assign Macro to Button

This button is now useless because we didn’t assign a macro. So, clicking on it will give us no result. So, see the steps below to learn how to assign a macro to the button.

📌 Steps:

  • Firstly, right-click on the button and select Assign macro… from the context menu.

Assign Macro to Button

Immediately, the Assign Macro dialog box appears.

  • Here, select Addition in the Macro name box.
  • As always, click OK.

Assign macro dialog box

  • Similarly, create all the necessary buttons like before.

different buttons of calculator

  • Moreover, follow the previous steps to assign macros to their respective buttons.

Assigning macro to create calculator using macros in Excel

All the work is done. Now, let’s check whether it is working or not.

  • Initially, give two inputs in cells C4 and C5.

giving inputs

  • Then, click on the + (plus) button and you’ll get the output in cell C10.

  • After that, click on the / (division) button and see the result in cell C10.

Doing division in Excel

To clear just the output in cell C10, tap on the Clear Output button.

Tapping on the Clear All button will delete the inputs and outputs.

Assigning macros to button to create calculator in Excel

Read More: How to Create Toggle Button on Excel VBA UserForm

How to Create a Pricing Calculator in Excel

Here, we’ll show how you can calculate the selling price of a product based on its cost and %markup. If we have the Cost and our expected %Markup, then the formula for calculating the Selling Price would be like that:

Selling Price = Cost * (1 + %Markup)

We’ll use this formula to create the pricing calculator in Excel. So, let’s explore this method step by step.

📌 Steps:

In the following image, we can see a list of some Products and their corresponding production Costs in columns B and C. Also, we have the expected Markup percentage in cell C4, which is 10%.

How to Create a Pricing Calculator in Excel

  • At first, create a new column with the heading Selling Price under Column D.
  • Then, write down the following formula in cell D7.
  • As usual, press ENTER.

You can use this calculator in your business also. Give your expected Markup percentage in cell D4 and your Costs in Column C. This calculator will calculate others.

Practice Section

For doing practice by yourself, we have provided a Practice section like the one below in each sheet on the right side. Please do it by yourself.

Download Practice Workbook

You may download the following Excel workbook for better understanding and practice.


This article explains how to create a calculator using macros in Excel in a simple and concise manner. Don’t forget to download the Practice file. Thank you for reading this article. We hope this was helpful. Please let us know in the comment section if you have any queries or suggestions.

Related Articles

Get FREE Advanced Excel Exercises with Solutions!


Shahriar Abrar Rafid
Shahriar Abrar Rafid

Shahriar Abrar Rafid, BSc, Naval Architecture and Marine Engineering, Bangladesh University of Engineering and Technology, Bangladesh, has worked with the ExcelDemy project for more than 1 year. He has written over 100+ articles for ExcelDemy. He is a professional visual content developer adept at crafting scripts, meticulously editing Excel files, and delivering insightful video tutorials for YouTube channels. His work and learning interests vary from Microsoft Office Suites and Excel to Data Analysis, VBA, and Video recording and... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF