# reverse number order in a cell

#### rolson7560

##### New Member
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"

#### SteveO59L

##### Well-known Member
How many digits is the cell likely to have ?

#### rolson7560

##### New Member
at this point only a max of 4, but that could change

#### MickG

##### MrExcel MVP
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

#### SteveO59L

##### Well-known Member

=(right(g18,1)&mid(g18,3,1)&mid(g18,2,1)&left(g18,1))*1

#### doofusboy

##### Well-known Member
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``````

#### rolson7560

##### New Member

This is great!!! Thank you!!!

#### Colin Legg

##### MrExcel MVP, Like totally RAD man
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)

#### rolson7560

##### New Member
THANK YOU ALL!!! It's amazing how many different ways this can happen!
I learned a LOT!

#### Ron Coderre

##### MrExcel MVP
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.

Replies
7
Views
143
Replies
11
Views
81
Replies
2
Views
44
Replies
1
Views
105
Replies
1
Views
79