Text function

RIGHT

Take characters from the end.

Purpose

Take characters from the end of a value

Returns

The last characters of the value, as text

Syntax

=RIGHT(text, [how_many])

ArgumentRequiredWhat goes here
textRequiredThe cell you are taking characters from.
how_manyOptionalHow many characters to take. One if you leave it out.

How to use RIGHT

RIGHT is LEFT from the other end: the value, and how many characters you want off the back.

It is the shortest way to get a fixed-width suffix, which on a ledger is usually the document number.

When the suffix varies in length, work out the count with LEN and FIND rather than guessing it.

Examples

Every result below is worked out by the same evaluator that marks your answers, on the sheet shown here.

Supplier import — raw.xlsxSheet1
A supplier export before anyone has cleaned it: padded names, a code buried in a reference, and amounts that arrived as text
ABCD
1ReferenceSupplier nameAmountPosted
2GL-6100-8801 brightwell paper 1500Y
3GL-6200-8802calder UTILITIES320y
4GL-6100-8803meridian freight ltd2750
5GL-6300-8804 ashgrove catering184Y
6GL-6200-8805THORNBURY print760
7GL-6100-8806Brightwell Paper1120Y
FormulaResult
=RIGHT(A2,4)The invoice number off the end of the reference.8801
=VALUE(RIGHT(A2,4))The same thing as a number, ready to be matched against a numeric invoice column.8801
=RIGHT(A2,LEN(A2)-FIND("-",A2))Everything after the first dash, however long that turns out to be.6100-8801

Notes

  • A reference that has picked up a trailing space gives the wrong answer here and looks right on screen. TRIM first if the source is an import.
Practise RIGHT in Unit 10

A reference tells you what it does. A unit makes you use it.