Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Moset
 
Posts: n/a
Default How do I invert text (abc--cba)

Is there a simple formula in Excel to invert text?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gilles Desjardins
 
Posts: n/a
Default How do I invert text (abc--cba)

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
"Moset" wrote in message
...
Is there a simple formula in Excel to invert text?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Moset
 
Posts: n/a
Default How do I invert text (abc--cba)

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 "text" 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) & Mid(num, 1, 1)) Else:
If Len(num) = 3 Then invert = (Mid(num, 3, 1) & Mid(num, 2, 1) & 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?)



"Gilles Desjardins" wrote:

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
"Moset" wrote in message
...
Is there a simple formula in Excel to invert text?




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Biff
 
Posts: n/a
Default How do I invert text (abc--cba)

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 = ""
For iCount = iLength To 1 Step -1
ReverseText = ReverseText & _
Mid(rt.Value, iCount, 1)
Next iCount
End Function

Biff

"Moset" wrote in message
...
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 "text" 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) & Mid(num, 1, 1)) Else:
If Len(num) = 3 Then invert = (Mid(num, 3, 1) & Mid(num, 2, 1) & 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?)



"Gilles Desjardins" wrote:

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
"Moset" wrote in message
...
Is there a simple formula in Excel to invert text?






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben
 
Posts: n/a
Default How do I invert text (abc--cba)

Moset

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

usage is =RevStr(cellref) or =RevStr("string")

If inverting numbers, they will become text so must be converted back to numbers
if to be used as such.

usage is =RevStr(cellref)*1


Gord Dibben MS Excel MVP


On Sat, 29 Apr 2006 20:13:02 -0700, Moset
wrote:

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 "text" 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) & Mid(num, 1, 1)) Else:
If Len(num) = 3 Then invert = (Mid(num, 3, 1) & Mid(num, 2, 1) & 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?)



"Gilles Desjardins" wrote:

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
"Moset" wrote in message
...
Is there a simple formula in Excel to invert text?





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shade cell according to text? Ltat42a Excel Discussion (Misc queries) 0 January 3rd 06 06:37 PM
Using Concatenate function to generate text in Text Box Mary S. Charts and Charting in Excel 1 December 14th 05 08:55 PM
merged cells into one text cell, size varies dependant on text dat Jazzylady825 Excel Discussion (Misc queries) 0 December 9th 05 08:26 PM
SUMPRODUCT vs Text??? Ken Excel Worksheet Functions 2 April 9th 05 07:21 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


All times are GMT +1. The time now is 05:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"