Course outline / Text functions
Lesson 36 of 75 · Intermediate · 3 exercises
Text tricks: REPT, CODE and CHAR
Repeat characters to draw bars, and work with character codes.
What you'll practise
- Draw a bar with REPT
- Character codes with CODE
- From a code back to a letter with CHAR
Draw a bar with REPT
REPT repeats text a number of times. Repeating a symbol by a number draws a quick bar chart inside a cell.
=REPT("|", 5) gives |||||.
In cell C2, repeat "|" as many times as Ana's deals in B2.
Character codes with CODE
Every character has a number. CODE returns it: "A" is 65, "B" is 66.
In cell E2, find the code of the letter in D2.
From a code back to a letter with CHAR
CHAR does the reverse, turning a code into its character. Adding 1 to a letter's code gives the next letter.
In cell E2, show the letter after D2, using CHAR(CODE(D2)+1).
Try it in a real spreadsheet
Every step checks your answer instantly and tells you exactly what to fix.