RIGHT


Returns text from the right side of a text string.

Syntax:

RIGHT(text, number)

returns number characters from the right side of the text text.

number defaults to 1 if omitted.

Example:

RIGHT("output", 3)

returns put.


Application:

Extracting Product IDs from a Product Code


Imagine you work for a company that sells electronics. Your product codes are structured in a way that the last 4 characters represent the unique product ID, while the characters before that represent the product category and other information. You have a list of full product codes, and you need to quickly extract only the product ID for inventory management and sales analysis.


Scenario:

You have the following table, where column A contains the full Product Code.

Product Code

A
1
TV-LED-42-2356
2
AUDIO-HP-BT-4912
3
LAPTOP-ULTRA-7890
4
CAM-DSLR-PRO-1122
5
GADGET-SMART-3456

The Goal:

Extract the last four digits from each Product Code and place them in the Product ID column (column B).


The Solution using the RIGHT function:

In cell B1, you would enter the following formula:

RIGHT(A1, 4)


Explanation of the formula:

  • RIGHT: This is the function name.
  • A1: This is the text argument, which specifies the cell containing the text string you want to work with. In this case, it's the product code "TV-LED-42-2356".
  • 4: This is the num_chars argument, which specifies the number of characters you want to extract from the right side of the text string. Here, we want the last 4 characters.


Final Table:

Product Code

Product ID

A
B
1
TV-LED-42-2356
2356
2
AUDIO-HP-BT-4912
4912
3
LAPTOP-ULTRA-7890
7890
4
CAM-DSLR-PRO-1122
1122
5
GADGET-SMART-3456
3456




This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof