# CInt
{: .no_toc }

Coerces an expression to an **Integer**.

Syntax: **CInt(** *expression* **)**

*expression*
: *required* Any valid string or numeric expression in the range `-32,768` to `32,767`. Fractions are rounded.

The return type is **Integer**.

When the fractional part is exactly `0.5`, **CInt** always rounds it to the nearest even number. For example, `0.5` rounds to `0`, and `1.5` rounds to `2`. **CInt** differs from the [**Fix**](/tB/Modules/Conversion/Fix.md) and [**Int**](/tB/Modules/Conversion/Int.md) functions, which truncate, rather than round, the fractional part of a number. Also, **Fix** and **Int** always return a value of the same type as is passed in.

**CInt** is the internationally aware alternative to [**Val**](/tB/Modules/Conversion/Val.md) for converting a string to a numeric type.

### Common Errors

| Error | When |
|---|---|
| [6 (`&H6`)](/Reference/Run-time-Errors.md#6), *Overflow* | *expression* rounds to a number less than -32,768 or greater than 32,767 |
| [13 (`&HD`)](/Reference/Run-time-Errors.md#13), *Type mismatch* | *expression* is a string that does not hold a number (a zero-length string included) |
| [94 (`&H5E`)](/Reference/Run-time-Errors.md#94), *Invalid use of Null* | *expression* is **Null** |

### Example

This example uses the **CInt** function to convert a value to an **Integer**.

```tb check_build
Dim MyDouble, MyInt
MyDouble = 2345.5678                 ' MyDouble is a Double.
MyInt = CInt(MyDouble)               ' MyInt contains 2346.
```

### See Also

- [CBool](/tB/Modules/Conversion/CBool.md), [CByte](/tB/Modules/Conversion/CByte.md), [CLng](/tB/Modules/Conversion/CLng.md), [CLngLng](/tB/Modules/Conversion/CLngLng.md), [CSng](/tB/Modules/Conversion/CSng.md), [CStr](/tB/Modules/Conversion/CStr.md), [CVar](/tB/Modules/Conversion/CVar.md) functions
- [Fix](/tB/Modules/Conversion/Fix.md), [Int](/tB/Modules/Conversion/Int.md) functions
