An Interactive Learning Tool

Proud to be a Teacher


Data Types

In computer science and computer programming, a data type or simply type is a classification of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support various types of data, for example: real, integer or Boolean. A Data type provides a set of values from which an expression may take its values. The type defines the operations that can be done on the data, the meaning of the data, and the way values of that type can be stored.
Void (e.g. no data)
Boolean (e.g. True or False)
Character (e.g. a)
String (e.g. abcd)
Integer (e.g. 1234)
Short (e.g. 0)
Floating-point number (e.g. 1.234)
Double (e.g. 1.79769313486232E308)
Long (e.g. 123456789)
Understanding the different data types allows programmers to design computer applications more efficiently and accurately.

Excel VBA uses following types of data types

Numeric Data Types
Numeric data types are types of data that consist of numbers, which can be computed mathematically with various standard arithmetic operators such as add, minus, multiply, divide and so on. In Excel VBA, the numeric data are divided into 7 types, which are summarized in below Table.

Type Storage Range of Values
Byte 1 Byte 0 to 255
Integer 2 Bytes -32,768 to 32,767
Long 4 Bytes -2,147,483,648 to 2,147,483,648
Single 4 Bytes -3.402823E+38 to -1.401298E-45 for Negative Values 1.401298E-45 to 3.402823E+38 for Positive Values
Double 8 Bytes -1.79769313486232e+308 to -4.94065645841247E-324 for Negative Values 4.94065645841247E-324 to 1.79769313486232e+308 for Positive Values
Currency 8 Bytes -922,337,203,685,477.5808 to 922,337,203,685,477.5807
Decimal 12 Bytes +/- 79,228,162,514,264,337,593,543,950,335 if no decimal used +/- 7.9228162514264337593543950335 (28 Decimal placed)


Non-Numeric Data Types
Type Storage Range of Values
String(fixed length) Length of String 1 to 65,400 characters
String (variable length) Length + 10 bytes 0 to 2 billion characters
Date 8 Bytes January 1, 100 to December 31, 9999
Boolean 2 Bytes True or False
Object 4 Bytes Any embedded object
Variant (numeric) 16 Bytes Any value as large as double
Variant (Text) Length +22 Bytes Same as variable-length String
Depending on the programming languages, there may also be many more data types that serve a specific function and storing data in a particular way.


Terms of use Website Policy Contact us
© Copyrights ExcelYourVBA.com 2020