A VBA function list is a reference to built-in functions you can call from Visual Basic for Applications, such as Left, DateAdd, IsNumeric, and Round. These functions handle common tasks in Excel macros, but they are different from worksheet functions such as SUM and XLOOKUP, which VBA can call through Excel.
What a VBA function list includes
VBA functions are predefined operations that return a value. A function can appear in an assignment, a condition, or another function call: fullName = UCase(firstName), for example, stores an uppercase version of a name. Some functions, including Date and Now, take no arguments; others accept one or more values.
The lists below cover commonly useful built-in functions, not every function in the VBA language and its runtime library. VBA also has statements, objects, properties, and methods that are not functions. For instance, Kill is a statement, while Workbook.Save is a method. Knowing the difference helps when looking up syntax or diagnosing an error.
In Excel for Microsoft 365 on Windows, VBA code is usually edited in the Visual Basic Editor, opened with Alt+F11. On a Mac, the shortcut is usually Option+F11; some keyboards require Fn as well. A macro can call built-in functions without installing an add-in.
Common VBA functions by category
Use this quick reference to find a function by the kind of work it does. The names are written as VBA calls; capitalization is not significant in VBA.
- Convert values:
CStrconverts a value to a string,CLngto a Long integer,CDblto a Double,CDateto a Date, andCBoolto a Boolean.CDecreturns a Variant with the Decimal subtype. - Work with text:
Left,Right,Mid,Len,Trim,Replace,InStr,Split,Join,LCase, andUCase. - Work with dates and times:
Date,Now,DateAdd,DateDiff,DateSerial,DateValue,Day,Month,Year, andWeekday. - Calculate or format numbers:
Abs,Fix,Int,Round,Sgn,Sqr,Rnd,Format,Hex, andOct. - Check values and types:
IsDate,IsNumeric,IsError,IsEmpty,IsNull,IsArray,TypeName, andVarType. - Handle arrays or choices:
Array,LBound,UBound,Choose,Switch, andIIf. - Other common tasks:
MsgBox,InputBox,Environ,Dir,FileLen, andFileDateTime.
String functions for text
String functions are useful when cleaning imported data, extracting parts of a cell value, or preparing text for a comparison. For example, Len returns a string’s character count; Left and Right return characters from either end; and Mid extracts characters from a specified position. InStr finds the position of one string inside another, while Replace substitutes matching text.
Split breaks a string into an array using a delimiter, and Join combines array elements into one string. Trim removes leading and trailing spaces, while LTrim and RTrim remove spaces from just one end. UCase and LCase change letter case. These functions return values; assigning the result is what changes a variable. For example, cleanText = Trim(rawText) does not modify rawText.
Two similarly named functions are easy to mix up: InStr searches from the beginning, and InStrRev searches from the end. If a search might not find its text, check the returned position: zero means no match. That is often safer than assuming the text is present.
Date and time functions
Date returns the current system date, while Now returns the current date and time. Time returns the current time, and Timer returns the number of seconds elapsed since midnight. The latter can help measure elapsed time during a procedure, though a calculation that crosses midnight needs special handling.
DateAdd moves a date forward or backward by an interval, and DateDiff calculates the number of intervals between two dates. DateSerial builds a date from year, month, and day values; DateValue converts a date-like string to a Date when VBA can interpret it. Functions such as Day, Month, and Year extract date parts.
Date interpretation can depend on regional settings, especially when text uses ambiguous formats such as 04/05/2026. For dependable macros, work with actual Excel date values or construct dates with DateSerial rather than relying on an ambiguous text string. Format can display a date in a chosen pattern, but formatting changes its appearance, not the underlying date value.
Numeric, conversion, and formatting functions
Conversion functions make a value’s intended type explicit. CInt converts to an Integer, CLng to a Long, CSng to a Single, and CDbl to a Double. Choose a type that can hold the expected range; a conversion can fail if the input is unsuitable or outside that type’s limits. CStr converts to text, but the resulting representation can depend on the value and regional settings.
Abs returns an absolute value, Sqr returns a square root, and Sgn indicates whether a number is negative, zero, or positive. Int rounds down to the next whole number, whereas Fix removes the fractional part toward zero. For example, applied to -8.4, Int returns -9 and Fix returns -8. This difference matters when values can be negative.
VBA’s Round uses banker’s rounding for exact halfway cases: it rounds to the nearest even last digit. That may differ from the rounding rule a user expects or from a worksheet calculation in a particular context. If a business rule requires a specific rounding convention, define and verify it rather than assuming Round always rounds halves away from zero.
Type checks, arrays, and conditional functions
Functions such as IsNumeric, IsDate, IsError, and IsArray return Boolean results that can guide a macro before it processes a value. TypeName returns a text description of a value’s type, and VarType returns a numeric type code. These checks can help with data imported from inconsistent sources, but they do not guarantee that a later conversion or calculation will succeed.
Array creates a Variant containing an array. LBound and UBound return the lower and upper index limits of an array dimension; checking those limits is safer than assuming every array starts at zero or one. An array produced by Split, for example, should be processed using its actual bounds.
Choose selects an item by its numeric position, while Switch evaluates condition-and-result pairs. IIf selects one of two values based on a condition, but there is an important trap: VBA evaluates both result expressions. Therefore, an unsafe expression in the branch that appears unselected can still cause an error. Use a regular If...Then...Else block when only one branch should run.
Using VBA functions in an Excel macro
The following procedure combines built-in VBA functions with an Excel worksheet function. It assumes the workbook has a worksheet named Sales and values to total in cells B2:B20. DateAdd calculates a date 14 days after today, and Format$ creates display text for the Immediate window.
Save a copy of the workbook before running a macro. Macro actions cannot be undone with Ctrl+Z. To keep VBA code in the workbook, save it in a macro-enabled format such as .xlsm.
Sub ShowSalesSummary()
Dim ws As Worksheet
Dim totalSales As Double
Dim reviewDate As Date
' Use the worksheet and range assumed in this example.
Set ws = ThisWorkbook.Worksheets("Sales")
totalSales = Application.WorksheetFunction.Sum(ws.Range("B2:B20"))
reviewDate = DateAdd("d", 14, Date)
' Print the results in the Visual Basic Editor's Immediate window.
Debug.Print "Total: "; Format$(totalSales, "Currency")
Debug.Print "Review date: "; Format$(reviewDate, "yyyy-mm-dd")
End Sub
The procedure uses Sum through Application.WorksheetFunction; that is an Excel worksheet function exposed to VBA, not a built-in VBA function. If the named sheet does not exist, the example needs its worksheet reference changed. Open the Immediate window in the Visual Basic Editor to see the printed results.
VBA functions versus Excel worksheet functions
Many people searching for a VBA function list actually want functions for a worksheet formula. The distinction is practical: a formula entered in a cell uses Excel’s worksheet function syntax, while code in a VBA module uses VBA syntax. Some names overlap, but availability and behavior are not identical. For example, Left is a VBA function, and SUM is an Excel worksheet function commonly called from VBA through Application.WorksheetFunction.Sum.
Excel also offers newer worksheet functions such as XLOOKUP, FILTER, and UNIQUE in Microsoft 365. Their presence in a worksheet does not make them ordinary VBA language functions. In VBA, you may call supported worksheet functions through Excel’s object model or write a formula into a cell, but the right approach depends on the function and the Excel version that will run the workbook. If a macro will be shared, check the target users’ versions before relying on newer worksheet features.
Choosing functions and avoiding common errors
Start with the value you need and the type it should have. Use a conversion function when you need a specific data type, a validation function when input may be unreliable, and a formatting function only when you need display text. Keeping a date as a Date or a total as a number makes later comparisons and calculations more dependable than converting everything to strings too early.
- Check function arguments and return types in the VBA Object Browser or Microsoft’s VBA language reference, especially for optional arguments.
- Use
IsErroror an appropriate error-handling strategy when input may contain Excel error values; a simple type check is not a substitute for handling every possible failure. - Be cautious with implicit conversions. A value that looks numeric as text may still include spaces, separators, or characters that prevent the conversion you expect.
- Use
Formatfor presentation, not as a way to perform a numeric or date calculation. It returns a string. - When a function name is unfamiliar, confirm that it is a VBA function rather than a worksheet function, a method, or a function available only in a particular library.
Frequently Asked Questions
How do I see the full VBA function list?
Use the VBA Object Browser in the Visual Basic Editor and consult Microsoft’s VBA language reference. The Object Browser can show functions available in the selected libraries; the exact list can vary with references and the Office environment.
Is SUM a VBA function?
No. SUM is an Excel worksheet function. VBA can call it as Application.WorksheetFunction.Sum, or a macro can use another approach such as looping through values.
What is the difference between a VBA function and a Sub?
A Function returns a value that code can use. A Sub performs actions but does not return a value as a function result. Both can contain VBA statements and call built-in functions.
Can I use VBA functions directly in an Excel cell?
Built-in VBA functions are not generally entered as worksheet formulas. Cell formulas use Excel’s worksheet functions. A custom VBA function can be written as a public Function in a standard module and used as a user-defined function, subject to workbook and security settings.
Why does VBA Round give an unexpected result?
VBA Round uses banker’s rounding for exact halfway values, which rounds to the nearest even digit. Check the required rounding rule and test boundary cases before using it for financial or business decisions.
Related
- Excel Subtotal Rows in Color: How to Highlight Them
- How to Delete Subtotal Rows in Excel Without Losing Data
- How to Group Rows in Excel Under a Heading: Step-by-Step
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- Read a Text File with Excel VBA: Methods and ExamplesYes. In Excel for Microsoft 365 on Windows, VBA can read a plain-text file with the Open and…
- VBA Copy and Paste Range in ExcelTo copy an Excel range with VBA, use sourceRange.Copy Destination:=destinationCell; Excel copies the cells to the destination, including…
- Excel VBA Data Types: Choosing the Right Variable for MacrosExcel VBA data types define what kind of value a variable can hold, such as a whole number,…
- Excel VBA Data Entry Form With a Picture Box: How It WorksYes. In Excel for Microsoft 365 on Windows, make a VBA UserForm, add an Image control to act…
- VBA Loop Code: Examples for Excel MacrosVBA loop code repeats an instruction for a set number of times, for each item in a collection,…
- VBA Array Add: How to Append Values and Resize an ArrayVBA has no built-in Array.Add method. To add values, use a dynamic array and resize it with ReDim…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.