CODEformula returns the numeric Unicode value of the first character in a text string. This can be useful when working with non-English characters or when attempting to identify certain characters in a text string.
- How to use
- Examples of using
CODEformula not working?
- Similar formulas to
CODE formula with the syntax shown below, it has 1 required parameter:
- string (required):
The text string for which to return the Unicode value of the first character.
ExamplesHere are a few example use cases that explain how to use the
CODEformula in Google Sheets.
Finding the Unicode value of a character
You can use the
CODE formula to find the Unicode value of any character in a text string. For example, you could use this to determine the Unicode value of a specific letter or symbol in a range of cells.
Working with non-English characters
CODE formula returns the Unicode value of a character, it can be helpful when working with non-English characters that may not be recognized by other formulas or functions.
Identifying certain characters in a string
CODE formula can also be used to identify certain characters in a text string. For example, you could use this formula to find all instances of a specific character in a larger block of text.
CODEnot working? Here are some common mistakes people make when using the
CODEGoogle Sheets Formula:
Providing a cell reference instead of a text string
One common mistake is to provide a cell reference as the argument for the
CODE formula, instead of a text string. Make sure to enclose the text string in quotation marks to avoid this error.
Providing a string with more than one character
CODE formula only returns the code for the first character in a text string. If you provide a string with more than one character, the formula will only return the code for the first character.
The following functions are similar to
CODE or are often used with it in a formula:
CHARformula returns the character corresponding to the ASCII code provided. This formula is commonly used to convert a numerical value to its corresponding character in a Google Sheets cell.
UNICHARfunction returns the Unicode character represented by the given numeric value. This is useful when working with non-Latin characters or symbols that cannot be easily typed on a keyboard. The function takes a single parameter, a number representing the Unicode value of the character to be returned.
FINDformula in Google Sheets searches for a specific text within another text and returns the position of the first occurrence of the text. This formula is often used to extract a substring from a larger string or to check if a certain text exists within another text.
SEARCHformula is used to find the position of a piece of text within a larger string of text. It returns the position of the first character of the searched text in the text being searched. This formula is case-insensitive, meaning it will find all instances of the searched text regardless of capitalization.
You can learn more about the
CODE Google Sheets function on Google Support.