Text
1.6K monthly searches
Beginner
4 min read

RIGHT Function in Excel - Extract Characters from Right

Extract specified number of characters from the end of text string with Excel RIGHT function....

Quick Start

Syntax

=RIGHT(text, [num_chars])

Parameters

text - Required. The text string to extract characters from.

num_chars - Optional. Number of characters to extract from the right. Defaults to 1 if omitted.

Simplest Example

AB
1TextResult
2Hello World
3report.xlsx
4Formula:
=RIGHT(A2, 5)
World

Quick Reference

Extract Last N Characters
=RIGHT(A1, 5)

Example: A1="Hello World"

=RIGHT("Hello World", 5) → "World"

Extract File Extension
=RIGHT(A1, LEN(A1)-FIND(".", A1))

Example: A1="document.xlsx"

=RIGHT("document.xlsx", 5) → "xlsx"

Get Last Name from Full Name
=RIGHT(A1, LEN(A1)-FIND(" ", A1))

Example: A1="John Smith"

=RIGHT("John Smith", 5) → "Smith"

Mask Credit Card (Last 4 Digits)
="****-****-****-"&RIGHT(A1, 4)

Example: A1="1234567890123456"

="****-****-****-"&RIGHT(..., 4) → "****-****-****-3456"

Real-World Examples

Extract Product SKU from Barcode

Parse product SKU numbers from barcodes or item identifiers. Retail operations, inventory management systems, and e-commerce platforms use the RIGHT function in Excel to automatically extract product codes from long barcodes. This RIGHT formula pattern is essential for warehouse management, order fulfillment automation, and product tracking systems where barcodes contain multiple pieces of information and you need to isolate the product identifier for database lookups and inventory control.

ABC
1BarcodeProductSKU
2CompleteSKU-2024-001-ABC123
3Formula:
=RIGHT(A2, 6)
ABC123
Pro Tip: Use with FIND to extract variable-length codes dynamically.
Parse File Extensions for Document Classification

Automatically extract file extensions (.pdf, .xlsx, .docx) from full file paths for document classification and validation. Document management systems, file processing workflows, and data entry operations frequently use the Excel RIGHT function to parse extensions from file names for automated sorting, type validation, and file handling rules. This RIGHT formula pattern enables data quality checks, automated report routing, and compliance tracking systems where file type validation is critical for business processes.

ABC
1FilenamePathExtension
2Documentreport-2024-final.xlsx
3Formula:
=RIGHT(A2, LEN(A2)-FIND(".", A2))
xlsx
Pattern: Combine RIGHT with FIND and LEN for variable-length extensions

Common Mistakes to Avoid

=RIGHT(A1)Omitting num_chars parameter

❌ The Problem:

  • Returns only the last 1 character by default
  • May not extract the intended portion of text
  • Requires manual recalculation if you need more characters

✅ Solution:

=RIGHT(A1, 5)

Always specify the number of characters to extract. If omitted, defaults to 1.

=RIGHT(A1, 100)Using num_chars larger than text length

❌ The Problem:

  • Returns entire text string instead of just the right portion
  • May cause logic errors in downstream formulas
  • Inconsistent results with shorter text values

✅ Solution:

=RIGHT(A1, MIN(10, LEN(A1)))

Use MIN with LEN to safely extract up to num_chars without exceeding text length.

=RIGHT(A1, -5)Using negative num_chars value

❌ The Problem:

  • Returns empty string instead of raising error
  • Unexpected behavior - silently returns nothing
  • Hard to debug in complex formulas

✅ Solution:

=IF(num_chars>0, RIGHT(A1, num_chars), "")

Validate that num_chars is positive before using RIGHT to avoid silent failures.

Frequently Asked Questions

Other Text Functions

Related Formulas

Master these RIGHT Function variants:

Master Excel RIGHT Function

From basics to advanced - AI generates perfect formulas instantly.