Is there a simple formula in Excel to invert text?
Yes use Data, text to column ( with your example will create a b c one
letter in each cell) then in a fourth one concatenate in reverse order.
HTH
Gilles
quot;Mosetquot; gt; wrote in message
...
gt; Is there a simple formula in Excel to invert text?
Thanks, but I figured out another way that works better for what I'm trying
to accomplish. I should have stated in my original post, I wanted to invert
numbers, not actually text, but I thought text might be easier, then I could
multiply the quot;textquot; by 1 to change it to a number. Here's my solution using
VB:===================================
Function invert(num)
If Len(num) = 1 Then invert = num Else:
If Len(num) = 2 Then invert = (Mid(num, 2, 1) amp; Mid(num, 1, 1)) Else:
If Len(num) = 3 Then invert = (Mid(num, 3, 1) amp; Mid(num, 2, 1) amp; Mid(num, 1,
1)) Else:
......
End Function
===================================
I could only get it to work for 55 characters because VB editor couldn't
handle a line of code any longer.If you're curious, I was trying to solve a math problem that states, if you
incrementally add the inverse of a number to the previous total, how many
times do you have to get that before the result is an anagram. For instance:
6
6 6=12
12 21=33 (Two iterations)
(does it show how much of a Geek I am that this is what I'm doing for fun on
a Sat night?)
quot;Gilles Desjardinsquot; wrote:
gt; Yes use Data, text to column ( with your example will create a b c one
gt; letter in each cell) then in a fourth one concatenate in reverse order.
gt; HTH
gt;
gt; Gilles
gt; quot;Mosetquot; gt; wrote in message
gt; ...
gt; gt; Is there a simple formula in Excel to invert text?
gt;
gt;
gt;
Try this UDF by Trevor Shuttleworth:
Function ReverseText(rt As Range)
Application.Volatile
Dim iLength As Integer
Dim iCount As Integer
iLength = Len(rt)
ReverseText = quot;quot;
For iCount = iLength To 1 Step -1
ReverseText = ReverseText amp; _
Mid(rt.Value, iCount, 1)
Next iCount
End Function
Biff
quot;Mosetquot; gt; wrote in message
...
gt; Thanks, but I figured out another way that works better for what I'm
gt; trying
gt; to accomplish. I should have stated in my original post, I wanted to
gt; invert
gt; numbers, not actually text, but I thought text might be easier, then I
gt; could
gt; multiply the quot;textquot; by 1 to change it to a number. Here's my solution
gt; using
gt; VB:
gt;
gt;
gt; ===================================
gt; Function invert(num)
gt;
gt; If Len(num) = 1 Then invert = num Else:
gt; If Len(num) = 2 Then invert = (Mid(num, 2, 1) amp; Mid(num, 1, 1)) Else:
gt; If Len(num) = 3 Then invert = (Mid(num, 3, 1) amp; Mid(num, 2, 1) amp; Mid(num,
gt; 1,
gt; 1)) Else:
gt; .....
gt; End Function
gt; ===================================
gt;
gt; I could only get it to work for 55 characters because VB editor couldn't
gt; handle a line of code any longer.
gt;
gt;
gt; If you're curious, I was trying to solve a math problem that states, if
gt; you
gt; incrementally add the inverse of a number to the previous total, how many
gt; times do you have to get that before the result is an anagram. For
gt; instance:
gt;
gt; 6
gt; 6 6=12
gt; 12 21=33 (Two iterations)
gt;
gt; (does it show how much of a Geek I am that this is what I'm doing for fun
gt; on
gt; a Sat night?)
gt;
gt;
gt;
gt; quot;Gilles Desjardinsquot; wrote:
gt;
gt;gt; Yes use Data, text to column ( with your example will create a b c one
gt;gt; letter in each cell) then in a fourth one concatenate in reverse order.
gt;gt; HTH
gt;gt;
gt;gt; Gilles
gt;gt; quot;Mosetquot; gt; wrote in message
gt;gt; ...
gt;gt; gt; Is there a simple formula in Excel to invert text?
gt;gt;
gt;gt;
gt;gt;
Moset
Public Function RevStr(Rng As Range)
RevStr = StrReverse(Rng.text)
End Function
usage is =RevStr(cellref) or =RevStr(quot;stringquot;)
If inverting numbers, they will become text so must be converted back to numbers
if to be used as such.
usage is =RevStr(cellref)*1Gord Dibben MS Excel MVPOn Sat, 29 Apr 2006 20:13:02 -0700, Moset gt;
wrote:
gt;Thanks, but I figured out another way that works better for what I'm trying
gt;to accomplish. I should have stated in my original post, I wanted to invert
gt;numbers, not actually text, but I thought text might be easier, then I could
gt;multiply the quot;textquot; by 1 to change it to a number. Here's my solution using
gt;VB:
gt;
gt;
gt;===================================
gt;Function invert(num)
gt;
gt;If Len(num) = 1 Then invert = num Else:
gt;If Len(num) = 2 Then invert = (Mid(num, 2, 1) amp; Mid(num, 1, 1)) Else:
gt;If Len(num) = 3 Then invert = (Mid(num, 3, 1) amp; Mid(num, 2, 1) amp; Mid(num, 1,
gt;1)) Else:
gt;.....
gt;End Function
gt;===================================
gt;
gt;I could only get it to work for 55 characters because VB editor couldn't
gt;handle a line of code any longer.
gt;
gt;
gt;If you're curious, I was trying to solve a math problem that states, if you
gt;incrementally add the inverse of a number to the previous total, how many
gt;times do you have to get that before the result is an anagram. For instance:
gt;
gt;6
gt;6 6=12
gt;12 21=33 (Two iterations)
gt;
gt;(does it show how much of a Geek I am that this is what I'm doing for fun on
gt;a Sat night?)
gt;
gt;
gt;
gt;quot;Gilles Desjardinsquot; wrote:
gt;
gt;gt; Yes use Data, text to column ( with your example will create a b c one
gt;gt; letter in each cell) then in a fourth one concatenate in reverse order.
gt;gt; HTH
gt;gt;
gt;gt; Gilles
gt;gt; quot;Mosetquot; gt; wrote in message
gt;gt; ...
gt;gt; gt; Is there a simple formula in Excel to invert text?
gt;gt;
gt;gt;
gt;gt;
- Dec 18 Mon 2006 20:34
How do I invert text (abc--gt;cba)
close
全站熱搜
留言列表
發表留言