Office tutorials

VBA mathematical functions

Description of mathematical functions in Excel VBA

Below are the names and descriptions of all standard math functions in Excel VBA. As you can see functions such as RND () do not require arguments. Functions such as ROUND () require 2 arguments – the value and the number of decimal places to which we round our value. Numbers with decimal places in VBA are introduced usingdots “.”, not a comma, as it does in the Excel spreadsheet.

[[tables]]]]]

VBA mathematical functions – an example of use

It’s time to test our functions. Let’s create a simple program, introducing to the cells of our sheet the results of all mathematical functions.

Below, the use of trigonometric functions:

If you would like to use the VBA math functions in conjunction with the worksheet functions, I invite you to the next part of our VBA training. You will learn how to use any VBA function from the Excel spreadsheet using VBA.

Tasks (You can enter the solution in a comment)

1. Replace the number 33.445 with an integer. Try to use three different functions for this purpose.
2. For the number -21, perform the following actions in the VBA code, which you will display in the form of the MsgBox window: absolute value calculation, square root, and rounding to 3 decimal places. At the end, multiply the number by 5.
3. For ambitious people: With the tangent function at their disposal, calculate the cotangent function with π / 4.

1 comment

1. • 18be on June 24, 2018 at 2:36 am

These are genuinely wonderful ideas in concerning blogging.
You have touched some fastidious factors here. Any way keep up wrinting.