VBA Math Functions

VBA Math Functions in Excel:

VBA Math Functions help us to perform arithmetic operations and complex mathematical operations. These are Abs, Atn, Cos, Exp, Fix, FormatNumber, FormatCurrency, FormatPercent, Int, Log, Randomize, Rnd, Round, Sgn, Sin, Sqr, Tan, etc. These functions are Built-In functions. We can use these VBA Math & Trig functions in either procedure or function. These functions we use in the VBA editor window in Excel. These Mathematical functions you can use any number of times in VBA macro codes.

List of Math Functions in Excel VBA:

Here are the list of Math functions. And also find its description, syntax and return type. We can use these multiple Math and Trig functions in one statement.

Function Description Syntax Returns
VBA Abs VBA Abs function returns an absolute value of a number. Abs(Number) Variant
VBA Atn VBA Atn function returns the arctangent of a number in radians, not degrees. Atn(Number) Double
VBA Cos VBA Cos function returns the cosine value of an angle in radians. Cos(Number) Double
VBA Exp VBA Exp function returns an exponential value for a specified number. Exp(Number) Double
VBA Fix VBA Fix function returns the integer portion of a number. Fix(Number) Double
VBA FormatNumber VBA FormatNumber function converts the given expression as formatted number. FormatNumber(Expression,[NumDigitsAfterDecimal],[IncludeLeadingDigit],[UseParentsForNegativeNumbers],[GroupDigits]) String
VBA FormatCurrency VBA FormatCurrency function converts the given expression as formatted currency. FormatCurrency(Expression,[NumDigitsAfterDecimal],[IncludeLeadingDigit],[UseParentsForNegativeNumbers],[GroupDigits]) String
VBA FormatPercent VBA FormatPercent function converts the given expression as formatted percentage. FormatPercent(Expression,[NumDigitsAfterDecimal],[IncludeLeadingDigit],[UseParentsForNegativeNumbers],[GroupDigits]) String
VBA Int VBA Int function rounds a specified number down to an integer. Int(Number) Double
VBA Log VBA Log function returns the natural logarithm of a specified number. Log(Number) Double
VBA Randomize VBA Randomize function changes the number in RND function which is used for random number generator. Randomize([Number]) N/A
VBA Rnd VBA Rnd function returns random number between 0 and 1. Rnd([Number]) Single
VBA Round VBA Round function rounds a number to a specified number of decimal digits. Round(Number,[NumDigitsAfterDecimal]) Double
VBA Sgn VBA Sgn function returns the sign of a number. Sgn(Number) Integer
VBA Sin VBA Sin function returns the sine value of an angle in radians. Sin(Number) Double
VBA Tan VBA Tan function returns the tangent value of an angle. Tan(Number) Double
VBA Sqr VBA Sqr function returns the square root of a number. Sqr(Number) Double

List of VBA Functions:

Please click on below link to go back to see all List of VBA Functions.

List of VBA Functions

1 thought on “VBA Math Functions in Excel”

Leave a Comment

Your email address will not be published. Required fields are marked *