Values & types - Coding concepts using Sheets
I'm writing a series of posts to explain basic coding concepts using Google Sheets. In this post, I will explain what a value is and I will also introduce the concept of a data type.
Values are the data used by a computer program
A spreadsheet is very similar to a computer program in that you have input data that you analyze or process (usually via formulas) to generate some output data.
Consider a spreadsheet containing the names, birthdays and test scores of 3 students. These would be the input data or input values. When you use the
AVERAGE() function to calculate the average test score, you're generating an output value using your "spreadsheet program".
Values have types
In Google Sheets, every value has a type. Some of the common types are:
- Boolean (true or false)
In many programming languages, these types are also known as "data types". The number of supported types can vary from one programming language to another but the concept (of a data type) itself can be found in most programming languages.
Dates are numeric values
In Google Sheets, dates and time are internally stored as numeric values even though they are formatted as dates when displayed to you.
You can use the
TYPE() function to find out the type of a value. This function returns
- 1 if the value is a number
- 2 if the value is text
- 4 if the value is boolean
Type of value
Dates are numeric values under the hood.
Stay up to date
I'd appreciate any feedback you can give me regarding this post.
Was it useful? Are there any errors or was something confusing? Would you like me to write a post about a related topic? Any other feedback is also welcome. Thank you so much!