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

Other Useful Resources:

Click on the following links of the useful resources. These helps to learn and gain more knowledge.

VBA Tutorial VBA Functions List VBA Arrays in Excel Blog

VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers

3 thoughts on “VBA Math Functions in Excel”

  1. Great іtems from you. I reallʏ like what you have bought here, really like what you’re stating
    and the ѡay in whicһ in which you are saying it. You are
    making іt entertaining and you still take care of to stay
    it smart. I can’t wait to read much more fгom you. This is actually a
    terrific site.

Leave a Reply