Mirror a number

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to mirror a number in a cell. For example, I want the product of 10 * 5 to equal 05 or at least be able to take a number like 1234 and change it to 4321 automatically.
Please help me!
 
Hi Steve
try the following UDF (not much checking, etc. included):

Function mirror(in_value) As Double
Dim c
Dim ret
For c = Len(CStr(in_value)) To 1 Step -1
ret = ret & Mid(CStr(in_value), c, 1)
Next
mirror = CDbl(ret)
End Function

Use it like the following in your worksheet:
=mirror(12345)
or
=mirror(A1)

Note: mirror(5*10) would return '5' as the leading '0' is skipped
 
One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

=TEXT(SUM(VALUE(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)) *
10^(ROW(INDIRECT("1:"&LEN(A2)))-1)),REPT("0",LEN(A2)))
 
Back
Top