# Create a formula with the Calculator

Use the Calculator to create formulas.

## Create the formula

Complete the following steps to create a formula.

1. Choose Calc > Calculator.
2. In Store result in variable, enter a column number (for example, C1), a constant number (for example, K1), or a column name (for example, Results). If the name contains spaces, enclose the name in single quotation marks.
3. In Expression, enter variable names, operations, and functions to build your formula. For information about functions, go to Calculator functions.
4. To assign the formula to the column, select Assign as a formula. When you assign a formula to a column, Minitab recalculates values automatically whenever you add, remove, or change associated data.
5. Click OK.

## Examples of calculator uses

The following examples demonstrate a few uses of the Calculator.

Calculate a mathematical formula
To calculate a mathematical formula, enter the storage column or the storage constant and the expression. For example, if you enter C11 in Store result in variable and MEAN(C10)/STDEV(C1) in Expression, then Minitab divides the mean of C10 by the standard deviation of C1 and stores the result in C11.
Store a value in a column or constant

To store a value in a column or a constant, enter the storage column or the storage constant and the value. For example, if you enter K1 in Store result in variable and 5 in Expression, then Minitab sets K1=5.

When you enter a text value, enclose it in double quotation marks, for example, "green".

Store true/false comparisons
To save the results of a true/false comparison, enter the storage column and the column comparison expression. For each value in the comparison column, Minitab enters a 1 in the storage column if the comparison is true and a 0 if it is false. The following expressions are examples of true/false comparisons:
• C1="green": Minitab stores 1 for each row that contains green, and stores 0 for all other rows.
• C1 > C2: Minitab stores 1 for each row where C1 > C2 and stores 0 for all other rows.
• C1 = WHEN("3/15/03"): Minitab stores 1 for each row that equals 3/15/03 12:00 am and stores 0 for all other rows.

## Formula guidelines

Formulas can consist of functions, arithmetic operations, comparison operations, logical operations, and column operations. Formulas can include columns, stored constants, numbers, and text, but not matrices. Follow these guidelines when you build formulas.

Parentheses ( )
To combine multiple operations in a complex expression, use parentheses, for example, (C1 + C2)/(C2 - C6). You can also use parentheses to identify the value or column of values for a function, for example, SIN(3.5) or SIN(C1).
Brackets [ ]
Specify a single value in a column by enclosing the row number of the data value in brackets. For example, if column C5 is named Revenue, the expressions 'Revenue' and C5 both return the value that is in row 27 of column C5.
Hyphens
In an expression, you cannot use a hyphen (-) to specify a range of values because Minitab interprets hyphens as minus signs. For example, Minitab interprets C1-C4 as C1 minus C4.
Text values
Enclose specific text values in double quotation marks, such as "green".
Currency or percentage format
Numeric data in currency or percentage format are primarily for display. You can enter these formats only with selected functions. For example, you cannot use the logical function ANY(C1,\$3.50) to identify the value \$3.50 in column C1 because the function ANY does not recognize the currency symbol \$.
Comparison operations
You can use the following comparison operations:
• = (equal to)
• <> (not equal to)
• > (greater than)
• < (less than)
• <= (less than or equal to)
• >= (greater than or equal to)

If the comparison is true, the result is set to 1. If it is false, the result is set to 0.

Missing values
Denote missing text values with double quotation marks that have no space between them (""). Denote missing numeric or date/time values with the missing value symbol * enclosed in single quotation marks ('*').
Logical operations
You can use the following logical operations:
• & (And)
• | (Or)
• ~ (Not)

You can use either the symbols (& | ~) or the words (And, Or, Not) in an expression.

If the comparison is true, the result is set to 1. If it is false, the result is set to 0.

Wildcard characters with text functions

Use an asterisk (*) to represent a string of one or more characters. Use a question mark (?) to represent only one character.

To reference a "*" character or a "?" character in a text string, use a tilde (~) before the symbol.

For examples, go to Find function and Search function.

## Order of operations

Minitab performs operations by rows, in the following order:
1. Subscripts
2. Constants and column operations
3. Functions
4. Exponentiation
5. "Not" and negative (-) operations
6. Multiplication and division
8. Comparison operations
9. "And" operations
10. "Or" operations

Operations of equal order are performed from left to right.

###### Tip

You can override the default order by using parentheses. Minitab runs expressions within the parentheses first.

## Considerations for calculator output

Consider the following information about calculator output when you build formulas.

Data type

If the last operation that is evaluated in an expression is a numeric operation, such as minus or MEAN, then Minitab stores the result as a number. For example, the result of TODAY() - 30 is a number because the last operation that is evaluated is minus, which is a numeric operation.

If the last operation that is evaluated is a date/time function, such as NOW or WHEN, then Minitab stores the result as a date/time value. For example, the result of DATE(TODAY() - 30) is a date value, because the last operation that is evaluated is DATE, which is a date/time function.

In Minitab, as with most spreadsheet applications, if you operate on a date/time variable with a number, for example, NOW() + 30, Minitab assumes the number is in units of days.

Currency or percentage formats
A function that can recognize data in currency or percentage format as input might not store the currency or percentage symbol with the result. For example, if you use the function SUM to add a column of data values in currency format, Minitab returns the sum of the values but does not return their associated currency symbol. However, if you store the result in a column, click in the column, right-click, choose Format Column, then select Currency or Percentage to format the column as currency or percentage and display the symbol.
Missing values
When Minitab cannot calculate an expression (for example, because the input is a missing value or because you try to compute the square root of a negative number), the result is set to missing. Minitab uses the missing value symbol * for a numeric or date/time column and a blank for a text column.
True/false comparisons or expressions
If an expression or comparison is true, the result is set to 1. If it is false, the result is set to 0. If the input column for <, <=, >, or >= contains a missing value, the result is set to missing.
Date/time values in stored constants
Stored constants do not recognize values in a date/time format. Because date/time values are stored internally as numbers, date/time values stored in a constant are the numeric equivalent of the corresponding date/time value.
By using this site you agree to the use of cookies for analytics and personalized content.  Read our policy