Excel VBA Functions

Last Updated on September 4, 2020 by token

VBA Numeric functions:

ABS – Returns absolute value of a number.
EXP – Returns exponential value of a number.
FIX – Returns integer value of a number. Rounds negative numbers up.
INT – Returns integer value of a number. Rounds negative numbers down.
LOG – Returns the value of the natural logarithm of the argument.
RND – Generates a random number in the 0-1 range.
ROUND – Rounds the number indicated in the argument to the specified number of decimal places.
SQR – Calculates the square root of the given number.
SGN – Returns the sign of a number. For positive 1, for negative -1.
SIN – Returns sinus of a value.
COS – Returns cosinus of a value.
TAN – Returns tangens of a value.
ATN – Returns arcustangens of a value.

VBA Text functions (Character functions / String functions)


ASC – Returns the position in the ASCII table for the character specified in the argument.
CHR – Converts a number representing a character in an ASCII array to an alphanumeric character.
INSTR – Finds text occurrences in other text and returns the position counting from the beginning of the string.
INSTRREV – Searches for occurrences of text within other text and returns the position counting from the end of the string.
LCASE – Converts characters in a text string to lowercase.
LEFT – Cuts text from other text starting from the left side.
LEN – Returns the length of a string.
LTRIM – Removes unnecessary spaces from the left side of a text string.
MID – Cuts a specified number of characters from text.
REPLACE – Replaces occurrences of one text with another text.
RIGHT – Cuts text from other text starting from the right side.
RTRIM – Removes unnecessary spaces from the right side of the text.
SPACE – Returns the number of spaces specified in the argument.
STR – Convert a number to text.
STRCOMP – Compares two text strings according to the length of the strings.
STRCONV – Converts a text string as specified by the given argument.
STRREVERSE – Returns text in reverse order.
TRIM – Removes unnecessary spaces from the beginning and end of the text.
UCASE – Convert letters to uppercase.
VAL – Returns numbers in a text string.

VBA Excel date and time functions

DATE – The function returns the current date.
DATEADD – The function adds a specified number of time units to a date or time.
DATEDIFF – The function returns the difference between two values ​​of dates or times in specified units, e.g. days.
DATEPART – The function returns the specified item from a date or a date and time. It can be day, month, year, quarter, hour, minute, second, etc.
DATESERIAL – Consists of the date with year, month and day.
DATEVALUE – Returns a date with a date and time. Rounds the date.
DAY – Returns the day of the month from a date.
HOUR – Returns the number of hours from time or date and time.
MINUTE – Returns the number of minutes from time or date and time.
MONTH – Returns a month from a date.
MONTHNAME – Returns the name of the day of the month.
NOW – Returns the current date and time or just the time.
TIMESERIAL – Consists of time in hours, minutes, seconds.
TIMEVALUE – Extracts time from date and time.
WEEKDAY – Returns the day of the week from a date
WEEKDAYNAME – Returns the name of the day of the week from a date.
YEAR – Returns the year from a date.

VBA Functions of the format and conversion of data types

CBOOL – Converts to the Boolean data type.
CBYTE – Converts to the Byte data type.
CCUR – Converts to the Currency data type.
CDATE – Converts to the Date data type.
CDBL – Converts to the Double data type.
CINT – Converts to the Integer data type.
CLNG – Converts to the Long data type.
CLNGLNG – Converts to the LongLong data type.
CSNG – Converts to the Single data type.
CSTR – Converts to the String data type.
CVAR – Converts to Variant data type.