ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to reverse cells value (https://www.excelbanter.com/excel-programming/348878-how-reverse-cells-value.html)

Jaemun

how to reverse cells value
 
How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?



Gord Dibben

how to reverse cells value
 
Public Function RevStr(Rng As Range)
If IsNumeric(Rng) Then
RevStr = StrReverse(Rng.Text) + 0
Else
RevStr = StrReverse(Rng.Text)
End If
End Function


Gord Dibben Excel MVP

On Sat, 24 Dec 2005 05:30:00 +0800, "Jaemun" <x wrote:

How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?


Jaemun

how to reverse cells value
 
Cool!

That was what I'm talking about (user define functions). But I want it
exactly the same.as what it have in the cell without removing the commas.

Thanks in advance.

Jaemun,

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Public Function RevStr(Rng As Range)
If IsNumeric(Rng) Then
RevStr = StrReverse(Rng.Text) + 0
Else
RevStr = StrReverse(Rng.Text)
End If
End Function


Gord Dibben Excel MVP

On Sat, 24 Dec 2005 05:30:00 +0800, "Jaemun" <x wrote:

How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?




Gord Dibben

how to reverse cells value
 
Do you want a number or text returned?

You originally stated "number" so I assumed it was a custom formatted number
which you would re-format after reversing.

Is 11,22,33,44 a custom formatted number or is it text that Excel thinks is a
number?

This will return 11,22,33,44 as 44,33,22,11 but as text.

Public Function RevStr(Rng As Range)
RevStr = StrReverse(Rng.text)
End Function


Gord

On Sat, 24 Dec 2005 06:13:07 +0800, "Jaemun" <x wrote:

Cool!

That was what I'm talking about (user define functions). But I want it
exactly the same.as what it have in the cell without removing the commas.

Thanks in advance.

Jaemun,

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Public Function RevStr(Rng As Range)
If IsNumeric(Rng) Then
RevStr = StrReverse(Rng.Text) + 0
Else
RevStr = StrReverse(Rng.Text)
End If
End Function


Gord Dibben Excel MVP

On Sat, 24 Dec 2005 05:30:00 +0800, "Jaemun" <x wrote:

How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?



Gary Keramidas

how to reverse cells value
 
knew there was strreverse function as gord described, but wanted to try some
convoluted approach to see what happend. i am sure someone can come up with
something else.

here is a macro that works here when the values are in column A if you run
it twice, it should put them back in the original order


Sub reverse()
Dim lastrow As Long
Dim rng As Range
Dim cell As Range
Dim r As Integer
r = 1
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row

For Each cell In Range("A1:A" & lastrow)
Set rng = Range("a" & r)
i = 1
l = Len(rng)
temp = cell
For i = 1 To Len(rng) - 1 Step 1
temp = temp & Mid(rng, l - i, 1)
Next
rng.Value = Mid(temp, l, l)
r = r + 1
Next
End Sub


--


Gary


"Jaemun" <x wrote in message
...
How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?





Jaemun

how to reverse cells value
 
BullsEye!!!
Excellent!

That was great. I thank you more than I can say:)

Jaemun.

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Do you want a number or text returned?

You originally stated "number" so I assumed it was a custom formatted

number
which you would re-format after reversing.

Is 11,22,33,44 a custom formatted number or is it text that Excel thinks

is a
number?

This will return 11,22,33,44 as 44,33,22,11 but as text.

Public Function RevStr(Rng As Range)
RevStr = StrReverse(Rng.text)
End Function


Gord

On Sat, 24 Dec 2005 06:13:07 +0800, "Jaemun" <x wrote:

Cool!

That was what I'm talking about (user define functions). But I want it
exactly the same.as what it have in the cell without removing the commas.

Thanks in advance.

Jaemun,

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Public Function RevStr(Rng As Range)
If IsNumeric(Rng) Then
RevStr = StrReverse(Rng.Text) + 0
Else
RevStr = StrReverse(Rng.Text)
End If
End Function


Gord Dibben Excel MVP

On Sat, 24 Dec 2005 05:30:00 +0800, "Jaemun" <x wrote:

How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?





Jaemun

how to reverse cells value
 
Hi Gary,

Actually, I'm preffered functions very much right now. Anyway, thank and my
appreciate for your help. And I could used that stuff too in my next work:)

Jaemun.


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
knew there was strreverse function as gord described, but wanted to try

some
convoluted approach to see what happend. i am sure someone can come up

with
something else.

here is a macro that works here when the values are in column A if you run
it twice, it should put them back in the original order


Sub reverse()
Dim lastrow As Long
Dim rng As Range
Dim cell As Range
Dim r As Integer
r = 1
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row

For Each cell In Range("A1:A" & lastrow)
Set rng = Range("a" & r)
i = 1
l = Len(rng)
temp = cell
For i = 1 To Len(rng) - 1 Step 1
temp = temp & Mid(rng, l - i, 1)
Next
rng.Value = Mid(temp, l, l)
r = r + 1
Next
End Sub


--


Gary


"Jaemun" <x wrote in message
...
How to the number that seperate with commas e.g. 11,22,33,44 to become
44,33,22,11 using formula functions?








All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com