MINUS macro

The MINUS macro is available in Unica Campaign and Unica Interact.

Syntax

data MINUS subtrahend data - subtrahend

Parameters

data

The cell range containing numbers to subtract from. This can be a constant value, a column, a cell range, or an expression evaluating to any of the above. For the format definition of data, see the "Macro Function Parameters" section in the chapter in this guide for your product.

subtrahend

The number(s) to subtract from all values in the specified column. This can be a constant value, a column, a cell range, or an expression evaluating to any of the above. The number of columns in subtrahend must equal the number of columns in data, unless subtrahend is a constant. For the format definition of subtrahend (same as data), see the "Macro Function Parameters" section in the chapter in this guide for your product.

Description

MINUS subtracts subtrahend from the specified data range data. It returns a new column for each input column, each containing the corresponding column in data minus the corresponding column of subtrahend (that is, the first column of data subtracts the first column of subtrahend, the second column with the second column, and so on).

If subtrahend is a constant, each value in data is subtracts that value. If subtrahend contains one or more columns, the calculations are performed on a row-by-row basis between one column from data and one column from subtrahend. The first row of data subtracts the first row value of subtrahend, the second row with the second row, and so on. This row-by-row calculation produces a result for each row up to the last value of the shortest column.

Note: The MINUS operator can be abbreviated with a minus sign or hyphen (-).

Examples

TEMP = 7 MINUS 4 or TEMP = 7 - 4

Creates a new column named TEMP containing the value three.

TEMP = V1 - 8

Creates a new column named TEMP, where each value is the contents of column V1 minus eight.

TEMP = V1:V3 - 2

Creates three new columns named TEMP, VX, and VY. The values in the TEMP column are the contents of column V1 minus two, the values of the VX column are the contents of column V2 minus two, and the values of the VY column are the contents of column V3 minus two.

TEMP = V1 - V1

Creates a new column named TEMP containing all zeros (since any number minus itself is zero).

TEMP = V1 - V2

Creates a new column named TEMP, where each value is the row value of column V1 minus the corresponding row value of column V2.

TEMP = V1:V3 -V4:V6

Creates three new columns named TEMP, VX, and VY. The column TEMP contains the values in V1 minus the corresponding row values of column V4. The column VX subtracts column V5 from V2. The column VY subtracts column V6 from V3.

TEMP = V1[10:20] - V2 or TEMP = V1[10:20] - V2[1:11]

Creates a new column named TEMP, where the first 11 cells contain the values in rows 10-20 of column V1 minus the values in rows 1-11 of column V2. The other cells in TEMP are empty.

Related functions

Function Description
PLUS Adds the contents of two data ranges
SUM or TOTAL Computes the sum of a range of cells