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.
^ArithmeticRight-associative计算左操作数的右操作数次幂,是 VB 算术运算中优先级最高的一类。
2 ^ 3+aArithmeticRight-associative保留数值本身,通常用于强调操作数为正值或数值表达式。
+score-aArithmeticRight-associative返回操作数的相反数,优先级高于乘除但低于乘方。
-amount*ArithmeticLeft-associative两个数值相乘。
price * count/ArithmeticLeft-associative执行除法并返回浮点结果。
total / count\ArithmeticLeft-associative执行整数除法,结果保留整数部分。
total \ 3ModArithmeticLeft-associative返回整数除法后的余数。
index Mod 2+ArithmeticLeft-associative将两个数值相加;在部分上下文中也可能参与字符串拼接。
a + b-ArithmeticLeft-associative从左操作数中减去右操作数。
endValue - startValue&String ConcatenationLeft-associative将两个表达式转换并连接为字符串,建议优先用它表达字符串拼接。
"VB" & "Script"=ComparisonNon-associative判断两个表达式是否相等。
status = "OK"<>ComparisonNon-associative判断两个表达式是否不相等。
status <> "OK"<ComparisonNon-associative判断左操作数是否小于右操作数。
age < 18>ComparisonNon-associative判断左操作数是否大于右操作数。
score > 90<=ComparisonNon-associative判断左操作数是否小于或等于右操作数。
count <= maxCount>=ComparisonNon-associative判断左操作数是否大于或等于右操作数。
count >= minCountLikeComparisonNon-associative按 VB 的通配符模式比较字符串。
fileName Like "*.txt"IsComparisonNon-associative判断两个对象引用是否指向同一对象,常与 Nothing 搭配。
obj Is NothingNotLogicalRight-associative对布尔表达式取反,也可对整数执行按位取反。
Not isReadyAndLogicalLeft-associative两个条件都为 True 时结果为 True,也可执行按位与。
isReady And hasAccessOrLogicalLeft-associative任一条件为 True 时结果为 True,也可执行按位或。
isAdmin Or isOwnerXorLogicalLeft-associative两个布尔值不同时返回 True,相同时返回 False。
flagA Xor flagBEqvLogicalLeft-associative两个布尔值相同时返回 True,不同时返回 False。
flagA Eqv flagBImpLogicalLeft-associative表示逻辑蕴含关系,仅当左侧为 True 且右侧为 False 时结果为 False。
flagA Imp flagBOverview
Understand what the tool solves, how it works, and the boundaries of its data.
This page is a curated Microsoft VBA reference, despite the shorter “VB” wording in the title. It groups operators by precedence and lets you search the symbol, English name, description, example, or group number. Category and associativity filters help narrow the list; matching entries show the group, operator, explanation, and a code example that you can copy.
A smaller group number means higher precedence. Read the list from top to bottom when operators with different priorities appear together:
| Group | Operator or operators | Category |
|---|---|---|
| 1 | ^ | Arithmetic |
| 2 | Unary - | Arithmetic |
| 3 | *, / | Arithmetic |
| 4 | \ | Arithmetic |
| 5 | Mod | Arithmetic |
| 6 | +, binary - | Arithmetic |
| 7 | & | String concatenation |
| 8 | =, <>, <, >, <=, >=, Like, Is | Comparison |
| 9 | Not | Logical |
| 10 | And | Logical |
| 11 | Or | Logical |
| 12 | Xor | Logical |
| 13 | Eqv | Logical |
| 14 | Imp | Logical |
All comparison operators share group 8. The table’s categories and numbers are a compact lookup aid for this listed set, not a complete language grammar.
Precedence identifies which operator group binds first when priorities differ. Associativity describes grouping when operators of the same priority repeat. In VBA, repeated exponentiation groups from left to right: 3 ^ 3 ^ 3 is read as (3 ^ 3) ^ 3, which gives 19683. Comparisons also share one priority and are handled left to right. A unary operator such as -amount has no binary associativity, so its filter value is “Not applicable (unary).”
For another quick check, 3 + 4 * 2 ^ 2 groups as 3 + (4 * (2 ^ 2)), giving 19. Parentheses can make a different intended grouping explicit.
&, Like, and Is; checked 2026-10-03.^; checked 2026-10-03.Null; checked 2026-10-03.Guide
Follow the workflow and verify inputs and outputs with practical examples.
Enter a term such as Mod, Like, “logical,” or 8. Search also matches the English descriptions and the code examples shown in the entries.
Choose arithmetic, string concatenation, comparison, or logical. You can also filter by left-associative, right-associative, or not applicable for unary operators. These filters can be combined; choose “All” to restore that dimension.
Results are grouped by precedence number, with lower numbers first. Each entry shows its symbol, category, associativity label, name, description, and example. Copy a symbol or example when you need to refer to it in your own code.
If nothing matches, remove a filter or clear the search term. The search field is for finding reference entries; it is not a place to paste or run a complete expression.
Use cases
See how the tool fits into real work and everyday tasks.
When a condition mixes And, Or, or comparisons, check their group numbers and then decide whether parentheses would make the author’s intent easier to maintain.
A learner can find less familiar entries such as Eqv and Imp, compare their positions with And and Or, and copy an example to study in a VBA editor.
For True Or False And False, the table shows that And has higher precedence than Or. That makes the grouping True Or (False And False); add parentheses in the source when the grouping needs to stand out.
Q&A
Find concise answers to common questions and confusing cases.
And or Or?And has higher precedence in this VBA table: it is group 10 and Or is group 11. For True Or False And False, group the And operation first.
No. It searches and filters the curated operator entries. It does not accept a full expression for parsing, execution, or validation.
A unary operator acts on one operand, as in -amount or Not isReady. Associativity is a grouping direction for repeated operators with operands on both sides, so it does not apply to a unary entry.
No. The list is identified as VBA and does not claim to cover VB.NET syntax. Check documentation for the language and version you are compiling against.
Notes
Review scope, result limitations, and important precautions before use.
This is a curated VBA lookup, not a compiler or a full expression validator. It does not inspect variable types, statement context, overloads, or the complete rules for coercion and Null. Those details can affect a real result even when the precedence grouping is correct.
For example, VBA + can add numbers or concatenate strings depending on the operands; use & when string concatenation is intended. The comparison operators can also behave differently according to operand types, and some comparisons can produce Null. Like performs pattern matching, while Is compares object references. Consult the linked VBA documentation for those semantics and for code targeting a particular environment. Use parentheses when you want the grouping to be unmistakable.
Related
Discover related tools, collections, and available API capabilities.