Operators used in computed column expressions
You can use the following the operators when you write expressions for a computed column.
Operator | Use to | Example |
---|---|---|
+ | Add two or more numeric values | [OrderAmount] + [SalesTax] |
- | Subtract one numeric value from another | [OrderAmount] - [Discount] |
* | Multiply numeric values | [Price] * [Quantity] |
/ | Divide numeric values | [Profit]/12 |
Ù | Raises a numeric value to a power | [Length]Ù2 |
% | Specify a percent | [Price] * 80% |
= | Test if two values are equal. | IF([ProductName] = "1919 Ford Falcon", "Discontinued Item", [ProductName]) |
> | Test if one value is greater than another value. | IF([Total]> 5000, [Total]*15%, [Total]*10%) |
< | Test if one value is less than another value. | IF([SalePrice]< [MSRP], "Below MSRP", "Above MSRP") |
>= | Test if one value is greater than or equal to another value. | IF([Total] >= 5000, [Total]*15%, [Total]*10%) |
<= | Test if one value is less than or equal to another value. | IF([SalePrice] <= [MSRP], "Below or equal to MSRP", "Above MSRP") |
<> | Test if two values are not equal. | IF([Country] <> "USA", "Imported product", "Domestic product") |
AND | Test if two or more conditions are true. | IF(([Gender] = "Male" AND [Salary] >= 150000 AND [Age] < 50), "Match found", "No match") |
OR | Test if any one of multiple conditions is true. | IF(([City] = "Boston") OR ([City] = "San Francisco"), "U.S.", "Europe and Asia") |
& | Concatenate string values. | [FirstName] & " " & [LastName] |