Extract the last N characters from a cell
=RIGHT(A2,$E$1)Excel · result on the sample sheet: 5 rows (B2:B6)
Describe what you need and get a working RIGHT formula for Excel and Google Sheets, tested on real data before you copy it. RIGHT returns a set number of characters from the end of a text string.
Each formula below was calculated on its own sample sheet. Open one to see the sheet, why it works, and to try it yourself.
=RIGHT(A2,$E$1)Excel · result on the sample sheet: 5 rows (B2:B6)
=$E$1&TEXT(A2,"00000")Excel · result on the sample sheet: 5 rows (B2:B6)
=RIGHT(A2,LEN($E$1))=$E$1Excel · result on the sample sheet: 6 rows (B2:B7)
=DATE(RIGHT(A2,4),MID(A2,2,1)*3-2,1)Excel · result on the sample sheet: 5 rows (B2:B6)
=OR(LEFT(A2)=" ",RIGHT(A2)=" ")Excel · result on the sample sheet: 6 rows (B2:B7)
=DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2))Excel · result on the sample sheet: 5 rows (B2:B6)
=DATE(RIGHT(A2,4),MID(A2,4,2),LEFT(A2,2))Excel · result on the sample sheet: 5 rows (B2:B6)
=C2-DATE(RIGHT(B2,4),MID(B2,4,2),LEFT(B2,2))Excel · result on the sample sheet: 5 rows (D2:D6)
You describe the task in plain English, and it writes the formula, using RIGHT where that's the right tool, for your table or a sample one. The formula is run in our engine in Excel and Google Sheets mode before you see it, so you get its result, not just a guess.
RIGHT returns a set number of characters from the end of a text string.
Yes. Each example below opens a page where you try the formula in a live grid and it's checked as you go, and the RIGHT function page has a practice exercise.