Excel VBA: How to Divide Without Remainder (2 Easy Ways)

The division is one of the most basic and frequent arithmetic operations in our daily life. At times, we need only the integer part from a division result which means division result without remainder. In this article, I will show you how to divide without remainder in Excel by using VBA.


How to Divide Without Remainder by Using Excel VBA: 2 Easy Ways

Assuming that we have a data set of 5 dividends in cells B5:B9 and 5 divisors in cells C5:C9. Now, we need to perform the division process and get 5 quotients in cells D5:D9 as integers without remainders.

Sample Dataset to Divide Without Remainder in Excel VBA

We want to accomplish this with Excel VBA. Follow any of the two ways given below to achieve this.


1. Division Using Backslash (\) Operator

We can divide numbers through Excel VBA by using the backslash (\) symbol to get the result as integers. Follow the steps below to do this.

📌 Steps:

  • First and foremost, go to the Developer tab >> Visual Basic tool.

Access the Visual Basic Tool

  • As a result, the VB Editor window will appear.
  • Following, go to the Insert tab >> Module option.

Insert a Module to Apply Excel VBA to Divide Without Remainder

  • Consequently, a new module named Module1 will be created.
  • Now, double-click on Module1 and insert the following VBA code in the code window.
Sub Backward_Slash_Division()
Range("D5") = Range("B5") \ Range("C5")
Range("D6") = Range("B6") \ Range("C6")
Range("D7") = Range("B7") \ Range("C7")
Range("D8") = Range("B8") \ Range("C8")
Range("D9") = Range("B9") \ Range("C9")
End Sub
  • Subsequently, press Ctrl + S on your keyboard.

  • As a result, a Microsoft Excel dialogue box would appear. Click on the No button.

Microsoft Excel Dialogue Box

  • Consequently, the Save As dialogue box would appear.
  • Following, choose the Save as type: option as .xlsm file and click on the Save button.

Save the Excel File as .xlsm File

  • At this time, close the code window and go to the Developer tab >> Macros tool.

Access Macros Tool

  • As a result, the Macro window would appear.
  • Following, click on the Backward_Slash_Division macro and click on the Run button.

Thus, the VBA code will run and give you the quotient without remainders for the divisions. And, the result should look like this.

Note
  • If you need your result somewhere else, declare that cell range inside the left side’s Range function. And, if the dividend and divisor are in different cells apart from the used range in the example, declare those cell ranges in the right side’s Range function as your own requirements.
  • If you use forward slash (/) instead of backslash (\) here, you will not get the integer quotient. Rather, you would get the actual quotient with decimals.

2. Using VBA Quotient Function to Divide One Cell by Another Without Remainder

Besides, you can use the Quotient function of VBA to divide cells and get results without remainders. Follow the steps below to accomplish the result of this process.

📌 Steps:

  • Similar to the first way, insert a module named Module2 in your Excel workbook.
  • Following, insert the following VBA code in the Module2 code window and press Ctrl + S.
Sub Division_Quotient_Function()
Range("D5") = WorksheetFunction.Quotient(Arg1:=Range("B5"), Arg2:=Range("C5"))
Range("D6") = WorksheetFunction.Quotient(Arg1:=Range("B6"), Arg2:=Range("C6"))
Range("D7") = WorksheetFunction.Quotient(Arg1:=Range("B7"), Arg2:=Range("C7"))
Range("D8") = WorksheetFunction.Quotient(Arg1:=Range("B8"), Arg2:=Range("C8"))
Range("D9") = WorksheetFunction.Quotient(Arg1:=Range("B9"), Arg2:=Range("C9"))
End Sub

VBA Code to Divide without Remainder in Excel

  • Afterward, save the Excel file in .xlsm format following the previous way.
  • Afterward, similar to the previous way, go to the Developer tab and click on the Macros tool to open the Macro window.
  • Following, choose the Division_Quotient_Function macro and click on the Run button.

Thus, you will get your desired result as integers without any remainder and the final result should look like this.

Divided without Remainder in Excel VBA

Note

If you need your result somewhere else, declare that cell range inside the left side’s Range function. And, if the dividend and divisor are in different cells apart from the used range in the example, declare those cell ranges in the Arg: argument as your own requirements.


Download Practice Workbook

You can download our practice workbook from here for free!


Conclusion

So, in this article, I have shown you two easy ways to divide without any remainder in Excel VBA. You can also download our free workbook to practice. I hope you find this article helpful and informative. If you have any further queries or recommendations, please feel free to comment here.

Get FREE Advanced Excel Exercises with Solutions!

Tags:

Tanjim Reza
Tanjim Reza

Md. Tanjim Reza Tanim, a BUET graduate in Naval Architecture & Marine Engineering, contributed over one and a half years to the ExcelDemy project. As an Excel & VBA Content Developer, he authored 100+ articles and, as Team Leader, reviewed 150+ articles. Tanim, leading research, ensures top-notch content on MS Excel features, formulas, solutions, tips, and tricks. His expertise spans Microsoft Office Suites, Automating Finance Templates, VBA, Python, and Developing Excel Applications, showcasing a multifaceted commitment to the... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo