reverse number order in a cell

rolson7560

New Member
Joined
Oct 14, 2009
Messages
4
I'd like to take the value from one cel, and reverse the digit order in another cell. Example cell c11 value is 1234, I want to display that value in cell c12 as 4321. Is there a way to do this?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi, This will reverse cell values in a list in column "A" to column "B".
You could run it as a Function, Or use it for just one cell.
Code:
[COLOR=navy]Sub[/COLOR] MG14Oct34
[COLOR=navy]Dim[/COLOR] Rng [COLOR=navy]As[/COLOR] Range, Dn [COLOR=navy]As[/COLOR] Range
[COLOR=navy]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng
    Dn.Next = StrReverse(Dn)
[COLOR=navy]Next[/COLOR] Dn
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
Regards Mick
 
Upvote 0
Here's one way:

Code:
Dim iCTR As Integer
Dim x As Integer
 
    For iCTR = 1 To 5
        For x = Len(Range("A" & iCTR).Value) To 1 Step -1
            Range("B" & iCTR).Value = Range("B" & iCTR).Value & Mid(Range("A" & iCTR).Value, x, 1)
        Next x
    Next iCTR
 
Upvote 0
Another way:

Excel Workbook
AB
131200213
Sheet1

Excel 2002
Cell Formulas
RangeFormula
B1=REVERSE(A1)




Code:
Public Function REVERSE(ByVal rngSource As Range) As Variant
    REVERSE = StrReverse(rngSource.Value)
End Function
(no error handling included)
 
Upvote 0
A bit late...but this formula reverses numbers of any length.
Code:
=MID(SUMPRODUCT(MID(A1,ROW($A$1:INDEX($A:$A,LEN(A1),1)),1)*10^
(ROW($A$1:INDEX($A:$A,LEN(A1)))-LEN(A1)-1)),3,255)

I hope that helps.
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,943
Members
448,534
Latest member
benefuexx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top