RIGHT

Return the last n characters of a piece of text.

Syntax

RIGHT(text, [num_chars])
Argument Required Description
text Required The text to take from.
num_chars Optional How many characters. Omitted, it returns one.

Examples

Every example below was executed against VisiGrid engine 0.35.0 — not transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.

Formula Result Notes
=RIGHT("Spreadsheet",5) sheet
=RIGHT("2026-08-10",2) 10 The day, from a date stored as text.
=RIGHT(REPT("0",3)&"7",3) 007 Padding a number to a fixed width — see REPT.

Padding to a fixed width

RIGHT with REPT is the reliable way to produce fixed-width codes — zero-padded IDs, invoice numbers, anything that has to line up:

=RIGHT(REPT("0",3) & "7", 3)      → 007
=RIGHT(REPT("0",3) & "1234", 3)   → 234

Note the second one: the pattern truncates from the left when the value is already longer than the width. If that matters, check the length first.

In Excel you would usually write TEXT(7,"000") instead. That does not work here yet — TEXT’s leading-zero format codes are unimplemented — so this is the pattern to use.

Excel compatibility

Matches Excel.

Related functions

Last updated