Home Privacy Policy Feedback Link to us Site Map

MS Excel: Asc Function (VBA only)


In Excel, the Asc function returns the ASCII value of a character or the first character in a string.

The syntax for the Asc function is:

Asc( string )

string is 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 of the characters after the first.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

Asc ("W") would return 87.
Asc ("Wednesday") would return 87.
Asc ("x") would return 120.

VBA Code

The Asc function can only be used in VBA code. For example:

Dim LResult As Integer

LResult = Asc ("W")

In this example, the variable called LResult would now contain the value 87.


View a listing of the ASCII values.