tech on the net
Home About Us Feedback Site Map

Microsoft

Access Excel Word

Database

SQL Oracle / PLSQL SQL Server MySQL MariaDB PostgreSQL

Web Development

HTML CSS Color Picker

Language

C Language

More

ASCII Table Linux UNIX Java Clipart Joke of the Moment
Share this page:

MS Excel: RIGHT Function (WS, VBA)

Learn how to use the Excel RIGHT function with syntax and examples.

Description

The Microsoft Excel RIGHT function extracts a substring from a string starting from the right-most character.

Syntax

The syntax for the Microsoft Excel RIGHT function is:

RIGHT( text, [number_of_characters] )

Parameters or Arguments

text is the string that you wish to extract from.

number_of_characters is optional. It indicates the number of characters that you wish to extract starting from the right-most character. If this parameter is omitted, only 1 character is returned.

Applies To

The RIGHT function can be used in the following versions of Microsoft Excel:

  • Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Type of Excel Function

The RIGHT function can be used in Microsoft Excel as the following type of function:

  • Worksheet function (WS)
  • VBA function (VBA)

Example (as Worksheet Function)

Let's look at some Excel RIGHT function examples and explore how to use the RIGHT function as a worksheet function in Microsoft Excel:

Microsoft Excel

Based on the spreadsheet above, the following Excel RIGHT examples would return:

=RIGHT(A1, 4) would return "soup"
=RIGHT("techonthenet", 6) would return "thenet"
=RIGHT(A2, 6) would return "et.com"
=RIGHT("Excel", 3) would return "cel"
=RIGHT("Microsoft") would return "t"

Example (as VBA Function)

The RIGHT function can also be used in VBA code in Microsoft Excel.

Let's look at some Excel RIGHT function examples and explore how to use the RIGHT function in Excel VBA code:

Dim LResult As String

LResult = Right("Alphabet",3)

The variable LResult would now contain the value of "bet".