totn Excel Functions

MS Excel: VBA Functions - Listed by Category

Learn how to use all Excel VBA functions used in Macros. VBA functions are built-in functions that are used in Excel's programming environment called Visual Basic for Applications (VBA).

Below is a list of Excel VBA functions sorted alphabetically. If you would like a list of these functions sorted by category, click on the following button:

Sort Alphabetically


(Enter a value in the field above to quickly find functions in the list below)

Lookup/Ref Functions

CHOOSE (VBA)Returns a value from a list of values based on a given position

String/Text Functions

ASC (VBA)Returns ASCII value of a character
CHR (VBA)Returns the character based on the ASCII value
CONCATENATE with & (VBA)Used to join 2 or more strings together using the & operator
FORMAT STRINGS (VBA)Takes a string expression and returns it as a formatted string
INSTR (VBA)Returns the position of the first occurrence of a substring in a string
INSTRREV (VBA)Returns the position of the first occurrence of a string in another string, starting from the end of the string
LCASE (VBA)Converts a string to lowercase
LEFT (VBA)Extract a substring from a string, starting from the left-most character
LEN (VBA)Returns the length of the specified string
LTRIM (VBA)Removes leading spaces from a string
MID (VBA)Extracts a substring from a string (starting at any position)
REPLACE (VBA)Replaces a sequence of characters in a string with another set of characters
RIGHT (VBA)Extracts a substring from a string starting from the right-most character
RTRIM (VBA)Removes trailing spaces from a string
SPACE (VBA)Returns a string with a specified number of spaces
SPLIT (VBA)Used to split a string into substrings based on a delimiter
STR (VBA)Returns a string representation of a number
STRCOMP (VBA)Returns an integer value representing the result of a string comparison
STRCONV (VBA)Returns a string converted to uppercase, lowercase, proper case or Unicode
STRREVERSE (VBA)Returns a string whose characters are in reverse order
TRIM (VBA)Returns a text value with the leading and trailing spaces removed
UCASE (VBA)Converts a string to all uppercase
VAL (VBA)Returns the numbers found in a string

Date/Time Functions

DATE (VBA)Returns the current system date
DATEADD (VBA)Returns a date after which a certain time/date interval has been added
DATEDIFF (VBA)Returns the difference between two date values, based on the interval specified
DATEPART (VBA)Returns a specified part of a given date
DATESERIAL (VBA)Returns a date given a year, month, and day value
DATEVALUE (VBA)Returns the serial number of a date
DAY (VBA)Returns the day of the month (a number from 1 to 31) given a date value
FORMAT DATES (VBA)Takes a date expression and returns it as a formatted string
HOUR (VBA)Returns the hours (a number from 0 to 23) from a time value
MINUTE (VBA)Returns the minutes (a number from 0 to 59) from a time value
MONTH (VBA)Returns the month (a number from 1 to 12) given a date value
MONTHNAME (VBA)Returns a string representing the month given a number from 1 to 12
NOW (VBA)Returns the current system date and time
TIMESERIAL (VBA)Returns a time given an hour, minute, and second value
TIMEVALUE (VBA)Returns the serial number of a time
WEEKDAY (VBA)Returns a number representing the day of the week, given a date value
WEEKDAYNAME (VBA)Returns a string representing the day of the week given a number from 1 to 7
YEAR (VBA)Returns a four-digit year (a number from 1900 to 9999) given a date value

Math/Trig Functions

ABS (VBA)Returns the absolute value of a number
ATN (VBA)Returns the arctangent of a number
COS (VBA)Returns the cosine of an angle
EXP (VBA)Returns e raised to the nth power
FIX (VBA)Returns the integer portion of a number
FORMAT NUMBERS (VBA)Takes a numeric expression and returns it as a formatted string
INT (VBA)Returns the integer portion of a number
LOG (VBA)Returns the natural logarithm of a number
MOD (VBA)Returns the remainder after a number is divided by a divisor
RANDOMIZE (VBA)Used to change the seed value used by the random number generator for the RND function
RND (VBA)Used to generate a random number (integer value)
ROUND (VBA)Returns a number rounded to a specified number of digits
SGN (VBA)Returns the sign of a number
SIN (VBA)Returns the sine of an angle
SQR (VBA)Returns the square root of a number
TAN (VBA)Returns the tangent of an angle

Logical Functions

AND (VBA)Returns TRUE if all conditions are TRUE
CASE (VBA)Has the functionality of an IF-THEN-ELSE statement
FOR...NEXT (VBA)Used to create a FOR LOOP
IF-THEN-ELSE (VBA)Returns a value if a specified condition evaluates to TRUE or another value if it evaluates to FALSE
OR (VBA)Returns TRUE if any of the conditions are TRUE
SWITCH (VBA)Evaluates a list of expressions and returns the corresponding value for the first expression in the list that is TRUE
WHILE...WEND (VBA)Used to create a WHILE LOOP

Information Functions

ENVIRON (VBA)Returns the value of an operating system environment variable
ISDATE (VBA)Returns TRUE if the expression is a valid date
ISEMPTY (VBA)Used to check for blank cells or uninitialized variables
ISERROR (VBA)Used to check for error values
ISNULL (VBA)Used to check for a NULL value
ISNUMERIC (VBA)Used to check for a numeric value

Financial Functions

DDB (VBA)Returns the depreciation of an asset based on the double-declining balance method
FV (VBA)Returns the future value of an investment
IPMT (VBA)Returns the interest payment for an investment
IRR (VBA)Returns the internal rate of return for a series of cash flows
MIRR (VBA)Returns the modified internal rate of return for a series of cash flows
NPER (VBA)Returns the number of periods for an investment
NPV (VBA)Returns the net present value of an investment
PMT (VBA)Returns the payment amount for a loan
PPMT (VBA)Returns the payment on the principal for a particular payment
PV (VBA)Returns the present value of an investment
RATE (VBA)Returns the interest rate for an annuity
SLN (VBA)Returns the depreciation of an asset based on the straight-line depreciation method
SYD (VBA)Returns the depreciation of an asset based on the sum-of-years' digits depreciation method

File/Directory Functions

CHDIR (VBA)Used to change the current directory or folder
CHDRIVE (VBA)Used to change the current drive
CURDIR (VBA)Returns the current path
DIR (VBA)Returns the first filename that matches the pathname and attributes specified
FILEDATETIME (VBA)Returns the date and time of when a file was created or last modified
FILELEN (VBA)Returns the size of a file in bytes
GETATTR (VBA)Returns an integer that represents the attributes of a file, folder, or directory
MKDIR (VBA)Used to create a new folder or directory
SETATTR (VBA)Used to set the attributes of a file

Data Type Conv. Functions

CBOOL (VBA)Converts a value to a boolean
CBYTE (VBA)Converts a value to a byte (ie: number between 0 and 255)
CCUR (VBA)Converts a value to currency
CDATE (VBA)Converts a value to a date
CDBL (VBA)Converts a value to a double
CDEC (VBA)Converts a value to a decimal number
CINT (VBA)Converts a value to an integer
CLNG (VBA)Converts a value to a long integer
CSNG (VBA)Converts a value to a single-precision number
CSTR (VBA)Converts a value to a string
CVAR (VBA)Converts a value to a variant