We use cookies.This website uses essential cookies to operate core features. With your consent, we also use analytics cookies to understand traffic and improve the service. For more details, see our .
Was this tool helpful to use?
Your feedback helps us make it better
Quickly check Visual Basic operator precedence and associativity. Resolve VB expression calculation issues with this free online reference guide.
Curated VBA operator groups checked against Microsoft documentation. Not a VB.NET table or a compiler; examples are not executed. Unary operators have no binary associativity. Type coercion, Null and full expression semantics require the VBA specification. Microsoft VBA
^ArithmeticLeft-associativeRaise the left operand to the power of the right operand. VBA evaluates repeated exponentiation from left to right.
2 ^ 3-aArithmeticNot applicable (unary)Negate a numeric operand; exponentiation has higher precedence.
-amount*ArithmeticLeft-associativeMultiply two numeric operands.
price * count/ArithmeticLeft-associativeDivide two numeric operands.
total / count\ArithmeticLeft-associativeDivide numeric operands using VBA integer-division conversion rules.
total \ 3ModArithmeticLeft-associativeReturn the remainder using VBA numeric conversion rules.
index Mod 2+ArithmeticLeft-associativeAdd numeric values; string concatenation and coercion depend on operand types. Use & for explicit concatenation.
a + b-ArithmeticLeft-associativeSubtract the right operand from the left operand.
endValue - startValue&String ConcatenationLeft-associativeConcatenate expressions as strings using VBA conversion rules.
"VB" & "Script"=ComparisonLeft-associativeCompare expressions for equality.
status = "OK"<>ComparisonLeft-associativeCompare expressions for inequality.
status <> "OK"<ComparisonLeft-associativeCompare whether the left expression is less than the right.
age < 18>ComparisonLeft-associativeCompare whether the left expression is greater than the right.
score > 90<=ComparisonLeft-associativeCompare whether the left expression is less than or equal to the right.
count <= maxCount>=ComparisonLeft-associativeCompare whether the left expression is greater than or equal to the right.
count >= minCountLikeComparisonLeft-associativeCompare a string against a VBA wildcard pattern.
fileName Like "*.txt"IsComparisonLeft-associativeCompare whether two references refer to the same object; also used with Nothing.
obj Is NothingNotLogicalNot applicable (unary)Negate a Boolean expression or complement integer bits.
Not isReadyAndLogicalLeft-associativeReturn the conjunction of Boolean expressions or combine integer bits with AND.
isReady And hasAccessOrLogicalLeft-associativeReturn the disjunction of Boolean expressions or combine integer bits with OR.
isAdmin Or isOwnerXorLogicalLeft-associativeFor Boolean values, return True when exactly one operand is True; integers use bitwise XOR.
flagA Xor flagBEqvLogicalLeft-associativeFor Boolean values, return True when the operands agree; integers use bitwise equivalence.
flagA Eqv flagBImpLogicalLeft-associativeFor Boolean values, return False only for True implying False; integers use bitwise implication.
flagA Imp flagBOverview
Understand what the tool solves, how it works, and the boundaries of its data.
Operator precedence tells you which parts of an expression are grouped first when different operators appear together. This reference organizes a curated set of Visual Basic for Applications (VBA) operators into numbered levels: level 1 is highest, and larger numbers are lower. Search or filter the list to compare operators without scanning every entry.
The table runs from exponentiation (^), unary negation, multiplication and division, integer division (\), Mod, addition and subtraction, string concatenation (&), comparison operators, and then logical or bitwise operators: Not, And, Or, Xor, Eqv, and Imp. Microsoft documents arithmetic before comparison and logical operations, with & after arithmetic and before comparisons.
Guide
Follow the workflow and verify inputs and outputs with practical examples.
Enter a symbol such as Mod, an operator name, part of its description or example, or a priority number. The search checks those displayed fields and updates the matching entries.
Choose arithmetic, string concatenation, comparison, or logical to focus the list. The associativity filter can show left-associated entries or unary entries marked as not applicable. The current curated data has no right-associated operator entries, so that filter may return no matches.
Entries are grouped from the highest-priority level to lower levels. Copy a symbol or sample expression for use in your own notes or editor. For example, 3 + 4 * 2 ^ 2 groups as 3 + (4 * (2 ^ 2)), giving 19 when the operands are ordinary numbers.
Use cases
See how the tool fits into real work and everyday tasks.
Look up an unfamiliar operator, compare its level with nearby arithmetic or logical operators, and use the displayed example as a starting point for a separate, runnable exercise.
When reading a long condition, compare the levels for Not, And, and Or. Add parentheses in the macro when they make the intended grouping easier for another maintainer to see.
Use the same operator names and priority levels to explain a grouping question, then verify the expression in the VBA host and with the relevant variable types.
Q&A
Find concise answers to common questions and confusing cases.
It indicates relative precedence: lower-numbered operators bind more tightly than higher-numbered ones. Parentheses can override that normal grouping, and operators sharing a level may have their own left-to-right handling.
VBA comparison operators share a precedence level and are handled in the order they appear from left to right. The list marks them accordingly. For readability, avoid relying on a chain of comparisons when explicit parentheses or separate conditions would make the intent clearer.
Unary negation and Not operate on one operand, so binary associativity does not apply to them. The current table labels these entries as not applicable rather than left or right.
No. This is a curated VBA operator reference. VB.NET has a different operator set, so consult the documentation for the exact language and version you are using.
Notes
Review scope, result limitations, and important precautions before use.
The entries are curated descriptions and examples; the page does not parse, compile, or execute an expression you enter. Its samples are illustrative and are not computed by the page. It also does not model a complete expression's types, conversions, Null behavior, or every contextual rule. Check the expression in the VBA environment where it will run, especially when operand types or object references matter.
Use this list for VBA, not as a complete VB6 or VB.NET language reference. In particular, the precedence table alone cannot establish whether a full expression is valid or what overloaded or type-dependent behavior it will have. Parentheses are a useful way to make intended grouping explicit.
Related
Discover related tools, collections, and available API capabilities.