> For the complete documentation index, see [llms.txt](https://help.taglo.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.taglo.io/data-types/data-types.md).

# Data Types

## Overview

Models uses seven data types to perform calculations, described in the table below.

<table><thead><tr><th width="173.33333333333331">Data Type</th><th width="319">Description</th><th data-type="content-ref">Link to Microsoft definition</th></tr></thead><tbody><tr><td><code>Double</code></td><td>Double-precision floating point number (Excel default number type)</td><td><a href="https://learn.microsoft.com/en-us/dotnet/api/system.double?view=net-8.0">https://learn.microsoft.com/en-us/dotnet/api/system.double?view=net-8.0</a></td></tr><tr><td><code>Integer</code></td><td>Represents whole numbers from negative to positive 2,147,483,648 (32-bits)</td><td><a href="https://learn.microsoft.com/en-us/dotnet/api/system.int32?view=net-8.0">https://learn.microsoft.com/en-us/dotnet/api/system.int32?view=net-8.0</a></td></tr><tr><td><code>String</code></td><td>Represents a text value</td><td><a href="https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0">https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0</a></td></tr><tr><td><code>DateTime</code></td><td>Represents a point in time</td><td><a href="https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-8.0">https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-8.0</a></td></tr><tr><td><code>Date</code></td><td>Represents a specific day</td><td><a href="https://learn.microsoft.com/en-us/dotnet/api/system.dateonly?view=net-8.0">https://learn.microsoft.com/en-us/dotnet/api/system.dateonly?view=net-8.0</a></td></tr><tr><td><code>Boolean</code></td><td>Logical value (TRUE or FALSE)</td><td><a href="https://learn.microsoft.com/en-us/dotnet/api/system.boolean?view=net-8.0">https://learn.microsoft.com/en-us/dotnet/api/system.boolean?view=net-8.0</a></td></tr><tr><td><code>Validation</code></td><td>Represents a value from a list of choices - each value is the Child <a href="/pages/an7Gx3oyqfu3oMXdJvny"><strong>Tag</strong></a> of a <a href="/pages/k2bV5AFRJlaHpxfx3lyx"><strong>Dimension</strong></a></td><td></td></tr></tbody></table>

The default Data Type for a [**Variable**](/variables/variable-basics.md) is `Double`.&#x20;

## Conversions

Models calculates values based on the Data Type of each Variable - if you use different Data Types in your Model, values will be converted to the Data Type of their Variable.

> For instance, if you have a Variable with Data Type `Integer`, which performs a Calculation based on two Variables with Data Type `Double`, the calculation will be performed with `Double` types, and then converted to an `Integer` (whole number).

You should bear in mind the following notes on conversions when using multiple Data Types.

<table><thead><tr><th width="177">Data Type</th><th>Conversion notes</th></tr></thead><tbody><tr><td><code>String</code></td><td>Text values cannot be converted to numerical values. An error will be shown.</td></tr><tr><td><code>DateTime</code> and <code>Date</code></td><td>See details below</td></tr><tr><td><code>Boolean</code></td><td><code>TRUE</code> is converted to 1, and <code>FALSE</code> converted to 0 when performing calculations (e.g., 100 * TRUE = 100)</td></tr><tr><td><code>Validation</code></td><td>A <code>Validation</code> value is treated as the text value of the name of its associated Tag</td></tr></tbody></table>

### DateTime/Date treatments

Both `DateTime` and `Date` are treated in the same way as Excel treats Dates (see [**here**](https://support.microsoft.com/en-us/office/datevalue-function-df8b07d4-7761-4a93-bc33-b7471bbff252#:~:text=Excel%20stores%20dates%20as%20sequential,date%20values%20to%20serial%20numbers.)), with 1st January 1900 stored as 1, with each subsequent day increasing the value by 1. Before performing calculations, Models converts Dates to serial numbers to ensure that calculations are performed identically to Excel.

Models treats a `Date` as midnight at the end of the day when converting to `DateTime`.\
\
Note, that Excel has a bug (described [**here**](https://learn.microsoft.com/en-us/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year)), in which 1900 is incorrectly assumed to be a leap year. Models replicates this bug to ensure consistency with Excel.

## Comparison with Excel

Excel uses a smaller set of Data Types than Models:

* Number
* Text
* Logical (`TRUE` or `FALSE`)
* Error

Excel does not differentiate between `Double` and `Integer` types, so this should be taken into account when generating Excel. You will need to use a rounding function in your Model if you want to force Excel to output an `Integer`.

Dates in Excel are stored as numbers, as described [**above**](#conversions).&#x20;

Excel does not automatically convert Logical values to 1 (`TRUE`) and 0 (`FALSE`).

> For instance, if cells A1 and B1 have values TRUE and FALSE respectively, then A1 + B1 = 1, but SUM(A1, B1) = 0.
>
> Using an equivalent SUM formula in Models would produce the result 1; therefore, it is important, if generating Excel from Models, to check that such calculations produce the desired result.
>
> As a rule of thumb, applying an operator to a `TRUE`/`FALSE` value (e.g. +, \*) ensures that the value is converted to a number.
