Share in Facebook


16 April 2018

CODE


Friends,

In my last two articles, I have discussed about the CHAR Function and how to use CODE function

But as you already know CHAR function’s output is one character which is easily identifiable by humans.

If you type =CHAR(97) in a cell, it will return you small ‘a’. But there might be a question in mind how did I know that ASCII code 97 represents ‘a’ ?

Is there any function which will tell us the ASCII code of a given alphabet or number or some special character ?


Yes, Microsoft Excel has provided us one function which will display the ASCII code of given character or number or special character. The function is CODE().

CODE function in excel works just opposite of CHAR function.

Today we will discuss about the CODE function.


Syntax

The syntax for the CODE function in Microsoft Excel is very simple.

=CODE(text/number/special character)

Parameters or Arguments

text/number/special character

The specified character to retrieve the ASCII value for. If there is more than one character, the function will return the ASCII value for the first character and ignore all the characters after the first.

Returns

The CODE function returns a numeric value.

Example :

I will give you two examples.
First, I will enter a character and this function will return the ASCII value of it.

Second, a little confusing, if you enter any number to get the ASCII code (e.g., you need the ASCII value of 10) you will get another number(49).

Why ASCII value is a number if I enter a ‘Number’ ?


Because ASCII value stores any character in number format. In an ASCII file, each alphabetic, numeric, or special character is represented with a 7-bit binary number (a string of seven 0s or 1s). 128 possible characters are defined.  

CODE Function in Excel to give ASCII value
CODE Function in Excel to give ASCII value

Hope you have enjoyed this article.
Thank you for reading…. 

No comments: