Discussion Locked

Math functions Excel 2000

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Is there math function in MS Excel that can convert for example: 1234 in one cell to 4321 in the same cell.

5 replies

by r. a. caluste

no direct formula but try this:

A1 = 1234
B1 = MID(A1,4,1) & MID(A1,3,1) & MID(A1,2,1) & MID(A1,1,1)
The result is B1 = 4321

hope this helps.

by dklippert

For 2000 and above:

This function ? MyStrReverse():

Function MyStrReverse(s As String) As String
Dim i As Long, rslt As String
For i = Len(s) To 1 Step -1
rslt = rslt & Mid(s, i, 1)
Next i
MyStrReverse = rslt

End Function
Combined with an on event action:
(Right click the tab and choose View code, Paste this code in the Visual Basic Editor):

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveCell.Value = MyStrReverse(ActiveCell)
End Sub

You have to reselect the cell to see the change.

This discussion is closed to new replies.