Variables Calculator
Variables
As discussed in the [https://.../t/help_create|Creating Templates Overview], variables are the names given to values whether those values are numbers, dates, tables or strings. To define a variable, type a name followed by the equals sign followed by an optional value.
In general PowerOne figures out what you meant as you type. The type indicated below the editor will list a row as unknown with its assumed type in parentheses. When you are done typing it will fix its type. This type can always be changed manually if desired.
Variable rows show an [icon--app-equals-known | known value button] button when the value is known, a [icon--app-unknown-inverse | unknown or unsure value button] button if the value is unknown or PowerOne is unsure. The button is colored if it can be calculated by selecting it or grey if it is not associated with an equation or the author chose to disable the button.
Naming Variables
A variable can contain any characters as long as it is defined to the left of an equals sign. This includes any text characters, numbers, emoji or math symbols. Variable names can also contain spaces. The following are examples of valid variable names:
<#Sides>
<2014 Sales>
The only restriction is that numbers (0 through 9, comma and point) cannot be used on its own and must include at least one other character.
Format
In its most basic form, a variable is defined as a name followed by an equals symbol. If you are calculating the value then nothing else is required:
You can also assign a value to a variable. That assigned value in the editor acts as a default value in the template. When a template is cleared, PowerOne will set the row to its default value. In this example, the number of years is defaulted to 30:
<#Years = 30>
There are five variable types: [https://.../t/help_variables_numbers|numbers], [https://.../t/help_variables_dates|dates], [https://.../t/help_variables_tables|tables], [https://.../t/help_variables_lists|lists] and [https://.../t/help_variables_strings|strings].
Numbers
By default, variable rows are considered numbers. A variable with no value assigned is considered a number variable. Number variables can include currency symbols, percent signs and descriptions. While currencies are simply for presentation purposes only, percent signs impact the mathematics.
Note that the displayed currency symbol and expected number format (1,000.00 or 1.000,00) is defined in the Settings via the extras (...) menu. (The thousands separators are optional during entry and are ignored. PowerOne will adjust and/or add them automatically.)
The following examples are all valid numbers:
<2014 Sales = 3,000,000>
PowerOne supports certain units as well. PowerOne supports certain length, area, volume, temperature, mass, and duration units in both Imperial and metric formats. Some examples:
Units do not get added or converted automatically. They must be designated by the template author.
[https://.../t/help_variables_numbers|Learn more about Number Variables].
Dates
Date variables are defined in day/month/year, month/day/year or year/month/day format where a slash (/) or dash (-) separates each component. Two-digit years will be translated automatically to 4-digit years. A description can follow a date.
The expected and displayed date format is defined in the Settings via the extras (...) menu.
To set a date to February 17, 2016 (when Date Format set to m/d/y):
To set a date to today:
[https://.../t/help_variables_dates|Learn more about Date Variables].
Tables
Tables, a collection of number or unit values, are defined using brackets [ ] to designate rows and columns with semi-colons separating values and rows. In the template, tables are defined without brackets but returns separating each row. A single-column table consisting of values 1, 2 and 3 would be defined as follows (select the template row to see its values):
A multi-column table with a first row consisting of values 1, 2, and 3 and a second row consisting of values 4, 5, and 6 would be defined as follows:
multi-column table = [[1; 2; 3]; [4; 5; 6]]
[https://.../t/help_variables_tables|Learn more about Table Variables].
Strings
String variables allow for the entry of arbitrary text in the template. Use quote marks to designate a string:
[https://.../t/help_variables_strings|Learn more about String Variables].
Lists
Lists are used when there is a finite set of options you want the user to choose from or if a text description makes more sense than a raw number. A list is really just an alternative method for entering a number. Each list item has an associated value assigned to it, whether set by PowerOne or by you.
Lists are defined similar to a number variable but include list options in braces following the default value. Within the braces each option is designated as the option's description followed by colon followed by the option's value. Each option is separated by semi-colons. Values are optional and will be designated by PowerOne if not provided where the first value is 1 and each subsequent value is one more than the previous option's value:
Which appears in the template as follows:
Payment Timing = 12
Amortize Interest? = 1
[https://.../t/help_variables_lists|Learn more about List Variables].
Creating Variable Names
Variables can either be created by typing them in one at a time or by including them in equations and letting PowerOne create them automatically. If you type your own variables then any characters can be used. If you let PowerOne derive variables from an entered equation, however, it will assume math symbols separate variables.
Take the following equation, where pre-release sales are added to post-release sales to derive a total sales figure:
If PowerOne creates its own variables, it will find four variables:
It assumes that the dash in Pre-Sales and Post-Sales is a subtract symbol.
Alternatively, if you define your own variables then you can define pre-sales and post-sales specifically, and PowerOne's equation will match those:
In this case only one variable is created automatically:
By default, variable names are case insensitive (Total Sales is the same as total sales). Select **Settings** then check **Case Sensitive Variables** to interpret all new variables as case sensitive instead. Turn this setting on then modify existing equations to reinterpret them as well.
In addition, changing the name of the variable will automatically adjust the variable name within the equation to match.
Indicators
When adding an equation, PowerOne indicates 1) new variables; and 2) which variables are used in the equation. The current row is marked with a blue bar while connected rows are marked with dark grey bar to the left of the row. Meanwhile, new variables are highlighted:
[https://poweronecalc.s3.amazonaws.com/help/editor_indicators_equation.png | variables used in equation indicator]
Conversely, which equations a selected variable is in is indicated the same way:
[https://poweronecalc.s3.amazonaws.com/help/editor_indicators_variables.png | equations containing variable indicator]
Multiple Variables With The Same Name
Variable names can be used multiple times in the same template. However, when determining the variables within an equation, PowerOne will find the matching variable closest to the equation and use it, whether that variable is above or below the equation. If the wrong variable is selected by PowerOne (as indicated in the section above), create the desired variable right above or below the equation then re-type that variable in the equation. It will select the correct one.
[https://.../t/help_equations | Learn more about Multiple Variables With The Same Name and Aliases in Equations].
Variable Details
Each row has additional details that can be set. Most of these details are available in the details view, available by selecting the **details** button just below the editor to see them. Type, however, is available all of the time. Variable options include:
- ++**Type**++: The row's type. Variable rows are listed as "?" where is either number, date, table, string or list while entering it the first time or if already fixed (returning to an existing variable row). This option can be changed by selecting the pop-up list below the editor. It is also displayed in details but cannot be modified there.
- ++**Alias**++: See the section [https://.../t/help_equations|Multiple Variables With The Same Name and Aliases] in Equations
- ++**Unit Stored As**++: Only visible in rows with units, this indicates how the units are stored for computational purposes. The stored unit and current displayed unit do not need to be the same. See [https://.../t/help_variables_numbers|Numbers] for details.
- ++**Decimals**++: Only visible in number rows, this sets how many decimal places to show for the variable. Options include float (show as many places as possible but eliminate trailing zeros) or 0 to 9 fixed places.
- ++**Inch**++: Only visible when a row is set to a length, this sets the maximum denominator used for fractional inches in feet-inch numbers. Options include 2, 4, 8, 16, 32 or 64. Numerators are rounded to this denominator and then reduced as appropriate.
- ++**Column Names**++: Available for tables, entered one per line (separated by returns), column names indicate what is in each column and appear below the table entry area in the template.
- ++**Second column is for occurrences**++: Available for tables with two columns, check this box if the second column in the table should be treated as an occurrences column. See [https://.../t/help_variables_tables|Tables] for details.
- ++**Constant**++: Set a variable to its value and never re-calculate. Constants are useful when a value is used in multiple equations and may never change or changes sporadically, making it easier to understand and update a template. These are also referred to as look-up values or tables. Constants are retained when clearing the template.
- ++**Hidden**++: Hides the row so it does not appear in the template. Very useful for calculating intermediate results that the template's user should not be able to see.
- ++**Read-only**++: Results for the row can be displayed but cannot be entered in the template. This has no impact within the editor.
- ++**Retain value when cleared**++: These values are ignored when clearing the template. Retain values allow the user to set their own defaults within the template itself.
- ++**Disable button**++: Disables the equals button for this variable. By default PowerOne shows buttons blue when they are included in equations and can or have been calculated. Sometimes, however, it is useful to indicate disabled instead. Selecting this option disables the buttons, showing them grey.
- ++**Include when sharing results**++: By default all variables visible in the template are included when sharing results. Uncheck this box to exclude variables in these cases instead.
- ++**Use default value on calculate only**++: Check this option to delay assigning a default value until a calculation occurs. It only appears if there is a default value defined.
- ++**Comment**++: Add any comments desired here. These are for your eyes only and will not appear to the template user.
Calculation Errors
There are two kinds of errors, syntax and calculation. A syntax error occurs when an equation is formed in a way PowerOne doesn't understand. Syntax errors are discussed in [https://.../t/help_equations|Equations].
Calculation errors occur when the result of a computation fails. When a calculation error occurs, the error is displayed next to the variable that was impacted. In this example a "Division by 0" error occurs because Gamma, the denominator in this division problem, is 0 and anything divided by 0 is undefined. The error button appears and the result for Alpha displays the error description:
Beta = 5
Gamma = 0
Alpha =
If the error impacts other variables then those variables also display an error, indicating the original, offending one. For example:
Delta =
Since Delta is calculated with Alpha, which already had an error, Delta gets an error also. In this case, though, it refers to the original variable that had the error.
Note that you do not need to delete the error to re-calculate. Changing Gamma to 2, for instance, will automatically correct all results.
Calculation errors include:
- ++**Not a number**++: the calculated result is not a number that PowerOne recognizes [i.e., sqrt(-1)]
- ++**+Infinity**++: the result is greater than approximately 1E300
- ++**-Infinity**++: the result is less than approximately -1E300
- ++**Division by 0**++: denominator is zero and thus any resulting answer is undefined [i.e, x/0 = y]
- ++**Can't find an answer**++: occurs if the result doesn't exist or it can't determine the answer [i.e., 0/x = 7]
- ++**Iteration limit exceeded**++: returned a result that is as close as PowerOne can calculate
In addition you can define your own errors using the [https://.../t/help_functions|errors()] function.
Keywords
Payment Timing
Amortize Interest?
Beta
Gamma
Alpha
Delta
-------------
Numbers
Units
Dates
Tables
Strings
Lists
Variable Names
Variable Naming
Aliases
Type
Unit
Current
Stored As
Decimals
Inches
Table
Round To
Column Names
Occurrences
Collapsible
Constant
Hidden
Read-Only
Retain Value When Cleared
Disable Button
Show as Source
Include when Sharing Results
Comment
Calculation Errors
Not a Number
+Infinity
-Infinity
Division by 0 Zero
Can't find an answer
Iteration limit exceeded
errors()
case sensitive
case sensitivity
Case Sensitive variables