Right Function

Return the right-most portion of a string. You can use the Len function to determine how many characters are in a string.  

Right (string, length)

Parameters

String - (Input, expression, Required)

Specifies the string from which the right-most characters are returned. If a numeric value is passed, it is first converted into a string. If Null is passed, the result is Null. If a non-string is passed, the result is Error.

Length  -  (Input, expression, Required)

Specifies the number of the right-most characters to return. If the length is zero, then a zero length string is returned. If the length is greater than the length of the string, then the entire string is returned. If the length is negative, the result is Error.

Return Value

A string value containing the right-most portion of the passed string.

Examples

Right (“abc”, 6)

Returns “abc”

Right (“abc”, “3”)

Returns “abc”

Right (“abc”, 1)

Returns “c”

Right (“abc”, 0)

Returns “”

Right (“abc”, -1)

Returns Error

Right (123, 2)

Returns “23”

Right (Null, 1)

Returns Null

Right (Error, 1)

Returns Error

TIP:

Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.

See Also

Functions | Asc function | Chr function | CSet function | Format function | InStr function | LCase function | Left function | Len function | LSet function | LTrim function | Mid function | Replace function | Right function | RSet function | RTrim function | Space function | String function | TCase function | Trim function | UBound function | UCase function


© 2004-2021 looksoftware. All rights reserved.