RIGHT Function in Excel Tutorial

Excel Tutorial

Introduction

The RIGHT function in Excel extracts a specified number of characters from the end of a text string. It is useful for extracting invoice numbers, product codes, employee ID suffixes, and other information from company data.

In this RIGHT Function in Excel tutorial, you will learn the RIGHT function through practical business examples, complete student tasks, and a final challenge.

RIGHT Function Syntax

=RIGHT(text, [num_chars])
  • text: The text or cell containing the data.
  • num_chars: The number of characters to extract from the right. This argument is optional.

Question 1: Extract the Last Four Digits of Invoice Numbers

Problem Statement

A company stores invoice numbers in Excel. The accounts department wants to extract the last four characters of each invoice number for quick identification.

Invoice NumberExtracted Code
INV-2026-58175817
INV-2026-72497249
INV-2026-90359035
INV-2026-41624162

Assume invoice numbers are stored in cells A2.

Excel Formula

=RIGHT(A2,4)

Expected Result: 5817 for the first invoice.

Student Task: Add a new invoice number INV-2026-8374 in cell A6. Use the formula to extract its last four characters.

New Expected Result: 8374


Question 2: Extract Product Category Codes

Problem Statement

A company uses product codes that end with a two-character category identifier. The inventory team wants to extract these identifiers.

Product CodeCategory Code
LAPTOP-ITIT
CHAIR-OFOF
PHONE-MBMB
TABLE-FNFN

Assume product codes are stored in cells A2.

Excel Formula

=RIGHT(A2,2)

Expected Result: IT for the first product.

Student Task: Add a new product code MONITOR-EL in cell A6. Extract its final two characters.

New Expected Result: EL


Question 3: Extract the Last Three Characters of Order IDs

Problem Statement

The sales department wants to identify orders using the last three characters of each order ID.

Order IDLast Three Characters
ORD-45821821
ORD-73946946
ORD-61257257
ORD-89413413

Assume order IDs are stored in cells A2.

Excel Formula

=RIGHT(A2,3)

Expected Result: 821 for the first order.

Student Task: Add the order ID ORD-62579 in cell A6. Extract its last three characters.

New Expected Result: 579


Question 4: Extract Employee Codes After Removing Extra Spaces

Problem Statement

An HR department receives employee codes with unwanted spaces at the beginning and end. Extract the last four characters after cleaning the text.

Employee CodeExtracted Code
EMP-58325832
EMP-71467146
EMP-90259025
EMP-62816281

Assume employee codes are stored in cells A2.

Excel Formula

=RIGHT(TRIM(A2),4)

Expected Result: 5832 for the first employee.

Student Task: Enter EMP-7459 in cell A6. Use the formula to remove the extra spaces and extract the last four characters.

New Expected Result: 7459


Question 5: Extract the Last Character from Employee Names

Problem Statement

A company wants to practise extracting the final character of each employee’s name.

Employee NameLast Character
Rahull
Priyaa
Amann
Simrann

Assume employee names are stored in cells A2.

Excel Formula

=RIGHT(A2)

Expected Result: l for Rahul.

Student Task: Add the name Karan in cell A6. Extract its last character.

New Expected Result: n


Student Tasks: RIGHT Function in Excel

Complete these exercises independently. Enter your formulas in the Expected Result column.

Task 1: Extract the Last Five Characters

Product ReferenceExpected Result
PROD-EXCEL5823158231
PROD-EXCEL7164271642
PROD-EXCEL9035490354

Task: Extract the last five characters from each product reference.

Task 2: Extract Department Identifiers

Department CodeExpected Result
COMPANY-HRHR
COMPANY-ITIT
COMPANY-FNFN

Task: Extract the last two characters from each department code.

Task 3: Extract the Last Four Characters

Transaction IDExpected Result
TXN-2026-48274827
TXN-2026-63916391
TXN-2026-75147514

Task: Write a formula to extract the last four characters of each transaction ID.


Final Student Challenge: Build an Inventory Code Summary

Problem Statement

You work as an inventory analyst for a company. The inventory manager stores product codes in Excel and wants you to extract useful information from the end of each code.

Use the following data:

Product NameInventory CodeRequired Output
LaptopINV-2026-58321Last 5 characters
MouseSTOCK-AB47Last 2 characters
KeyboardITEM-927Last 3 characters
MonitorPROD-EXCEL125Last 3 characters
PrinterBATCH-7418Last 4 characters
WebcamINV-2026-63924Last 5 characters

Your Tasks

  1. Extract the required number of characters from each inventory code using the RIGHT function.
  2. Use cell references instead of typing codes directly into formulas.
  3. Apply the formulas to all rows using the fill handle.
  4. Add a new product named Headphones with inventory code INV-2026-74286 and extract the last five characters.
  5. Verify that all results contain the correct number of characters.

Expected Results

Product NameExpected Output
Laptop58321
Mouse47
Keyboard927
Monitor125
Printer7418
Webcam63924
Headphones74286

Bonus Challenge: If cell A2 contains PEN, what will =RIGHT(A2,10) return? Explain why Excel returns that result.

Final Goal: Build an inventory worksheet that extracts the required characters from product codes and updates automatically when new products are added.


Key Takeaways

  • The RIGHT function in excel extracts characters from the end of text.
  • The num_chars argument specifies how many characters to return.
  • If num_chars is omitted, Excel returns the last character.
  • If the text is shorter than the requested length, Excel returns the entire text.
  • Combining RIGHT Function with TRIM helps remove unwanted leading and trailing spaces.
  • RIGHT returns text, even when the extracted characters look like numbers.

Frequently Asked Questions (FAQs)

1. What is the RIGHT function in Excel?

The RIGHT function extracts a specified number of characters from the end of a text string.

2. What is the syntax of the RIGHT function?

The syntax is =RIGHT(text, [num_chars]).

3. What happens if I omit num_chars?

Excel returns only the last character of the text.

4. Can RIGHT extract numbers from an invoice ID?

Yes. For example, =RIGHT(A2,4) extracts the last four characters of an invoice ID. The result is text, even if it contains only digits.

5. What happens if I request more characters than the text contains?

Excel returns the entire text rather than producing an error.

6. Can I combine RIGHT with TRIM?

Yes. =RIGHT(TRIM(A2),4) removes leading and trailing spaces before extracting the last four characters.

7. What is the difference between LEFT and RIGHT?

LEFT extracts characters from the beginning of text, whereas RIGHT extracts characters from the end.

8. Can RIGHT extract text after a hyphen?

RIGHT extracts a fixed number of characters from the end. If you need to extract a variable-length section after a hyphen, TEXTAFTER may be more suitable in supported Excel versions.