Do you know how to transpose the numbers within a cell, for example, cell A1 says 12345, I want cell B1 to say 54321. Is that possible?
[Solved] Formulas : Inverting number
- bearcub
- Closed
-
-
-
There is a utility called asap utilities, available free from
http://www.asap-utilities.com
One option on the text menu is to reverse text in selected cells. Works well.Richard
-
Hi BearCub
I have a custom function here:
http://www.ozgrid.com/VBA/ReverseCell.htmThat will work in Excel 97 and above.
-
Dave sent me to a web site to get this formula.
How does it work?
Function ReverseCell(Rcell As Range, Optional IsText As Boolean)
Dim i As Integer
Dim StrNewNum As String
Dim strOld As StringstrOld = Trim(Rcell)
For i = 1 To Len(strOld)
StrNewNum = Mid(strOld, i, 1) & StrNewNum
Next i
If IsText = False Then
ReverseCell = CLng(StrNewNum)
Else
ReverseCell = StrNewNum
End If
End FunctionUsing the loop (i = 1 to Len(stgOld)) starts it off. When the Mid function is used inside the loop causes each character to be used. What would happen if the Len was used? Only one character would be shown?
-
Hi BearCub
Did it work for your data?
Len is used to return the number of characters in a String. This is what is used to determine how many loops to perform.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!