开发者

Convert numbers 1-26 to A-Z?

开发者 https://www.devze.com 2023-03-28 06:21 出处:网络
How can I convert the numbers in the range 1 through 26 to 开发者_运维技巧their respective letter position in the alphabet?

How can I convert the numbers in the range 1 through 26 to 开发者_运维技巧their respective letter position in the alphabet?

1 = A

2 = B

...

26 = Z


CHR(#) will give you the ASCII character, you just need to offset it based on the ASCII table:

e.g. A = 65, so you will need to add 64 to 1:

CHR(64 + #) = A if # is 1


ASCII code is the numerical representation of a character such as 'a' or 'Z'. Therefore by looking at the table one can see that capital A has a value of 65 and Z has a value of 90. Adding 64 from each value in the range 1-26 will give you their corresponding letter.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号