REVERSE

REVERSE(value [,reversewords])
Returns the characters of a text string in reverse.

valueThe text string you want to reverse.
reverse_words(Optional) A logical value indicating whether to reverse words or characters:
True = reverse the words instead of the characters
False = reverse the individual characters (default)

REMARKS
* If "reverseWords" is left blank, then False is used.
If the argument is not a number or a text string, then #N/A is returned.
This uses the built-in VBA function STRREVERSE.
=REVERSE(REVERSE()) = ??
Columns=1

 A
1=JS.REVERSE("some text")
2=JS.REVERSE("better solutions")
3=JS.REVERSE("some text",TRUE)
4=JS.REVERSE("better solutions",TRUE)

1 - What is the text string "some text" with the characters reversed.
2 - What is the text string "better solutions" with the characters reversed.
3 - What is the text string "some text" with the words reversed.
4 - What is the text string "better solutions" with the words reversed.


Public Function REVERSE( _ 
         ByVal sCellContents As String) _
         As String

   If Application.WorksheetFunction.IsNonText(sCellContents) = True Then
      REVERSE = VBA.CVErr(xlCVError.xlErrNA)
   Else
      REVERSE = VBA.StrReverse(sCellContents)
   End If
End Function

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext