CODE Function in Excel simplifies character analysis by providing a straightforward solution for obtaining the numeric Unicode value of a single character. Whether you’re analyzing text strings, extracting data patterns, or performing data validation, CODE Function in Excel ensures accuracy and consistency in your results. Say goodbye to manual character analysis and hello to efficiency with this versatile function. From identifying character codes to implementing complex text processing tasks, CODE Function in Excel streamlines your workflow, saving you time and effort. Take control of your character analysis tasks and optimize your Excel experience with the powerful capabilities of CODE Function. With just a simple formula, you can easily obtain Unicode values, making it easier to manipulate and analyze text data effectively. Embrace the convenience and reliability of CODE Function in Excel and elevate your spreadsheet skills to new heights of productivity and accuracy.
This Content Covers:
- What is CODE Function in Excel?
- Syntax, Purpose, and Arguments of CODE Function
- How to use/access the CODE Function in Excel?
- From Formula Tab
- Typing Manually
- Different uses of CODE Function in Excel
- Getting the ANSI Code of Alphabet
- Getting the ANSI Code of Numerical Digits
- Getting the ANSI Code of Symbols
- CODE Function with Word or Sentence
- CODE Function with Other Functions
1. What is CODE Function in Excel?
The CODE function in Microsoft Excel is a built-in function that is used to determine the ASCII or ANSI code for the selected character in a supplied dataset. After accepting any type of character as input, the method returns the numeric code, including letters, numbers, symbols, etc. It finds out the code for the first character only.
2. Syntax, Purpose, and Arguments of CODE Function
Syntax: =CODE(text)
Purpose: The purpose of CODE function is to Get the code for a character
Arguments: There is only one argument for CODE function,
text- The text for which you are looking for a numerical code.
3. How to use/access the CODE Function in Excel?
There are two ways you can use or access the CODE function. You can either use the function from Formula tab or you can type it directly inside a cell.
3.1 From Formula Tab
Step 1: Select a cell where you want to use the CODE function and then go to Formulas tab. Select Text option and click on CODE from the drop-down list.
Step 2: A Function Arguments dialogue box will open. Insert or type the text you want to get the code of inside Text box and press OK.
Step 3: This will return you a code value for the first character of the input text.
3.2 Typing Manually
Step 1: Select a cell and start typing the code with =C, you will see the CODE function in the drop-down list. Double click on it and type the text inside then press Enter key.
4. Different uses of CODE Function in Excel
4.1 Getting the ANSI Code of Alphabet
Step 1: Select cell B3 and insert the CODE function in it.
Step 2: Press Enter key to get the result.
Step 3: Drag the fill-handle down to B7 to get ANSI code for all of these input alphabets. Here you can notice that letter “D” and “d” have different CODE though they are the same letter. Which means ANSI code for upper- case and lower-case letters are different. We can see the difference in case of “Z” and “z” too.
4.2 Getting the ANSI Code of Numerical Digits
Step 1: Enter the CODE formula in B3 like before and press Enter key.
Step 2: Drag B3 down to B7. In this example, we have used the CODE function to get ANSI code of some numerical values. Now look at the code value of 9 and 99, both of them has same code value. Though we had 99 in A5 cell, the CODE function only takes a string’s first letter or digit. So, in this case the CODE function took 9 from 99 and returned its code value.
4.3 Getting the ANSI Code of Symbols
Step 1: Use the CODE function here in the same way to get the ANSI code for these symbols.
4.4 CODE Function with Word or Sentence
Step 1: Use the CODE function in B3, press Enter key and drag the fill handle down.
Step 2: As we have seen in the first and second example, the CODE function only takes the first letter or digit or symbol from a string and the code value for upper- case and lower-case letters are different. So, although we used words and sentences here, the CODE function only took the first letter as its input and returned the ANSI code for that letter or alphabet. We also see difference in code value of same letters (“M”, ”m”/”O”, ”o”) for being upper and lower case.
4.5 CODE Function with Other Functions
In the previous example we saw two different values for the same word “Muffin” and “muffin” because of the case difference of the first letter “M” and “m”. By using the UPPER and LOWER function with CODE function, we can get the ANSI code of a lower-case letter from upper-case letter/word/sentence, and we can get code of lower-case letter from upper-case letter/word/sentence.
Step 1: Select cell B6 and insert this combined function of CODE and LOWER functions in that cell. Then press Enter key to get the result.
Step 2: Select cell B7 and insert this combined function of CODE and UPPER functions in that cell.
Step 3: Hit the Enter key. Here we can see that though we had an upper-case “M” in cell A6, the formula in B6 has returned the code of lower- case “m” because of using LOWER function with CODE function in that cell. The same thing happened in B7 too, by using the UPPER function with CODE function we got the code of upper- case “M” from a word which had a lower- case “m” as the first letter.
Application of CODE Function in Excel
- Character Analysis: Utilize the CODE function in Excel to obtain the numeric Unicode value of a single character within a text string.
- Text Manipulation: Extract specific characters from text strings based on their Unicode values using the CODE function, facilitating data manipulation tasks.
- Data Validation: Validate input data by comparing the Unicode values of characters to predefined criteria using the CODE function in Excel.
- Text Parsing: Parse text strings into individual characters and analyze their Unicode values for pattern recognition or data extraction purposes.
- Encoding Conversion: Convert characters from one encoding scheme to another by obtaining their Unicode values with the CODE function in Excel.
- Text Sorting: Sort text data based on the Unicode values of characters to achieve customized sorting orders or to identify anomalies in data sets.
For ready-to-use Dashboard Templates: