CODE and CHAR functions in a spreadsheet

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

CODE and CHAR functions in a spreadsheet

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does =CODE("A") return in a spreadsheet?
A 65
B 1
2. Which formula turns the number 66 back into a letter?
A =CHAR(66)
B =CODE(66)
3. What does =CHAR(65) return?
A 65
B A
4. Cell A2 holds the letter C. Which formula gives its number code?
A =CHAR(A2)
B =CODE(A2)
5. Which code is the LAST upper-case letter, Z, given by =CODE("Z")?
A 90
B 91

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1=CODE("A") AReturns the number code of the letter A, which is 65
2=CHAR(66) BThe letter A is not in quotes, so the spreadsheet treats it as a name, not text. It should be =CODE("A") or a cell like =CODE(A2).
3Find the number code of the letter stored in cell A2 CReturns the letter that has the number code 66, which is B
4Turn the number 90, the code for the last capital letter, back into a letter D=CHAR(90)
5=CODE(A) ECHAR needs a number code, not a letter. To get a letter use =CHAR(65), or use =CODE("A") to get the number.
6=CHAR("A") F=CODE(A2)

Definitions

=CODE("A")

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
=____("A")
2.
=CHAR(__)
3.
=____(66)
4.
=CHAR(____(A2)+1)
5.
=CHAR(__)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A A2: H
B B2: =CHR(A2)
C C2: =CHAR(B2)
Question 2
A Goal: find the code for C
B =CODE(C)
C Result: 67
Question 3
A Goal: turn 70 into a letter
B Cell A2 holds 70
C =CODE(A2)
Question 4
A A2: D
B B2: =CODE(A2)
C C2: =B2+1
D D2: =CHAR("C2")
Question 5
A =CHAR("A")
B Result: 65
C Next letter: =CODE("B") is 66

Answer Key

CODE and CHAR functions in a spreadsheet
Section A: Quick Questions
Q1
A — 65
Q2
A — =CHAR(66)
Q3
B — A
Q4
B — =CODE(A2)
Q5
A — 90
Section B: Match the Pairs
Q1
=CODE("A") → Returns the number code of the letter A, which is 65
Q2
=CHAR(66) → Returns the letter that has the number code 66, which is B
Q3
Find the number code of the letter stored in cell A2 → =CODE(A2)
Q4
Turn the number 90, the code for the last capital letter, back into a letter → =CHAR(90)
Q5
=CODE(A) → The letter A is not in quotes, so the spreadsheet treats it as a name, not text. It should be =CODE("A") or a cell like =CODE(A2).
Q6
=CHAR("A") → CHAR needs a number code, not a letter. To get a letter use =CHAR(65), or use =CODE("A") to get the number.
Section C: Definitions
Q1
=CODE("A") — Gives the number code of a letter, so =CODE("A") returns 65. Its partner =CHAR(65) turns a code back into a letter. Capital letters start at 65 (A) and run to 90 (Z).
Section D: Fill in the Blanks
Q1
=CODE("A")
Q2
=CHAR(65)
Q3
=CHAR(66)
Q4
=CHAR(CODE(A2)+1)
Q5
=CHAR(90)
Section E: Spot the Error
Q1
B — There is no CHR function in a spreadsheet. The function that gives a letter's number code is CODE, so the line should be B2: =CODE(A2).
Q2
B — A letter typed straight into CODE must be inside quotes. Without quotes, the spreadsheet reads C as a name and gives an error. It should be =CODE("C").
Q3
C — CODE turns a letter into a number, but this goal needs a number turned into a letter. Use CHAR: =CHAR(A2) gives F.
Q4
D — Quotes around C2 make it plain text, not a cell reference, so CHAR gets no number and gives an error. It should be D2: =CHAR(C2), which gives E.
Q5
A — CHAR needs a number, not a letter, so =CHAR("A") gives an error. To get 65 from the letter A, use =CODE("A").