Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
starguy
 
Posts: n/a
Default Reversing characters of cells


how can I reverse the characters of cells.

(data) (should be)
12345 54321
2456 6542
asdf fdsa
23 32

any formula which can do this?


--
starguy
------------------------------------------------------------------------
starguy's Profile: http://www.excelforum.com/member.php...o&userid=32434
View this thread: http://www.excelforum.com/showthread...hreadid=551348

  #2   Report Post  
Posted to microsoft.public.excel.misc
Alan
 
Posts: n/a
Default Reversing characters of cells

Can't think of a generic formula but you could use VBA. Position cursor
over the cell you want to reverse and then run RunReverseData

Sub RunReverseData()
Dim CellAddress as string

CellAddress = Activecell.Address
Call ReverseData(CellAddress)
End Sub

Sub ReverseData(byval CellRef as string)
Dim i as Integer
Dim Data as string
Dim ShouldBe as string

ShouldBe=""
Data = Range(CellRef).Value
for i = 1 to Len(Data)
ShouldBe=ShouldBe & Mid(Data,Len(Data) - (i-1),1)
Next i
Range(CellRef).Value = ShouldBe
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
starguy
 
Posts: n/a
Default Reversing characters of cells


thanks but I need formula. any guru... on this problem


--
starguy
------------------------------------------------------------------------
starguy's Profile: http://www.excelforum.com/member.php...o&userid=32434
View this thread: http://www.excelforum.com/showthread...hreadid=551348

  #4   Report Post  
Posted to microsoft.public.excel.misc
Paul Lautman
 
Posts: n/a
Default Reversing characters of cells

starguy wrote:
how can I reverse the characters of cells.

(data) (should be)
12345 54321
2456 6542
asdf fdsa
23 32

any formula which can do this?


If you know the maximum size of the string in a cell (I shall assume 16)
then:

=MID(A1,16,1)&MID(A1,15,1)&MID(A1,14,1)&MID(A1,13, 1)&MID(A1,12,1)&MID(A1,11,1)&MID(A1,10,1)&MID(A1,9 ,1)&MID(A1,8,1)&MID(A1,7,1)&MID(A1,6,1)&MID(A1,5,1 )&MID(A1,4,1)&MID(A1,3,1)&MID(A1,2,1)&MID(A1,1,1 )


  #5   Report Post  
Posted to microsoft.public.excel.misc
Paul Lautman
 
Posts: n/a
Default Reversing characters of cells

starguy wrote:
how can I reverse the characters of cells.

(data) (should be)
12345 54321
2456 6542
asdf fdsa
23 32

any formula which can do this?


alternatively, change the reversedata sub into a function:

Function ReverseData(cellcont)
Dim i As Integer
Dim ShouldBe As String

ShouldBe = ""
For i = 1 To Len(cellcont)
ShouldBe = ShouldBe & Mid(cellcont, Len(cellcont) - (i - 1), 1)
Next i
ReverseData = ShouldBe
End Function




  #6   Report Post  
Posted to microsoft.public.excel.misc
starguy
 
Posts: n/a
Default Reversing characters of cells


thanks its good and easy but too much lengthy to type especially when I
have to use it frequently but with different data.


--
starguy
------------------------------------------------------------------------
starguy's Profile: http://www.excelforum.com/member.php...o&userid=32434
View this thread: http://www.excelforum.com/showthread...hreadid=551348

  #7   Report Post  
Posted to microsoft.public.excel.misc
Paul Lautman
 
Posts: n/a
Default Reversing characters of cells

starguy wrote:
thanks its good and easy but too much lengthy to type especially when
I have to use it frequently but with different data.

Confused???
What is too lengthy to type?


  #8   Report Post  
Posted to microsoft.public.excel.misc
starguy
 
Posts: n/a
Default Reversing characters of cells


this formula of MID...

Paul Lautman Wrote:
starguy wrote:
thanks its good and easy but too much lengthy to type especially

when
I have to use it frequently but with different data.

Confused???
What is too lengthy to type?



--
starguy
------------------------------------------------------------------------
starguy's Profile: http://www.excelforum.com/member.php...o&userid=32434
View this thread: http://www.excelforum.com/showthread...hreadid=551348

  #9   Report Post  
Posted to microsoft.public.excel.misc
starguy
 
Posts: n/a
Default Reversing characters of cells


this formula of MID...

Paul Lautman Wrote:
starguy wrote:
thanks its good and easy but too much lengthy to type especially

when
I have to use it frequently but with different data.

Confused???
What is too lengthy to type?



--
starguy
------------------------------------------------------------------------
starguy's Profile: http://www.excelforum.com/member.php...o&userid=32434
View this thread: http://www.excelforum.com/showthread...hreadid=551348

  #10   Report Post  
Posted to microsoft.public.excel.misc
Paul Lautman
 
Posts: n/a
Default Reversing characters of cells

starguy wrote:
this formula of MID...

Paul Lautman Wrote:
starguy wrote:
thanks its good and easy but too much lengthy to type especially
when I have to use it frequently but with different data.

Confused???
What is too lengthy to type?


Well, first of all you posted the statment attached to my post about the VBA
function not the MID one. With the VBA function you only need to type
something like =ReverseData(A1) in a cell or possibly
=PERSONAL.XLS!ReverseData(A1) depending on where you stored the UDF.

Secondly, you say "when I have to use it frequently but with different
data". The different data makes no difference to what you need to enter, the
formula remains the same.

Thirdly, when I have a long formula like that that I need to use often, I
either make it into a UDF (which I offered you) or if I want to always do it
in pure Excel functions, I certainly don't retype it every time I want to
use it!!! I store functions like this in a workbook and copy and paste them
to other books whenever I need them. If you always retype formulas then more
fool you!






  #11   Report Post  
Posted to microsoft.public.excel.misc
starguy
 
Posts: n/a
Default Reversing characters of cells


thanks again for explaining. Infact when cell reference is different
then it would be tidy to change it in formula on frequent basis.


--
starguy
------------------------------------------------------------------------
starguy's Profile: http://www.excelforum.com/member.php...o&userid=32434
View this thread: http://www.excelforum.com/showthread...hreadid=551348

  #12   Report Post  
Posted to microsoft.public.excel.misc
starguy
 
Posts: n/a
Default Reversing characters of cells


thanks again for explaining. Infact when cell reference is different
then it would be tidy to change it in formula on frequent basis.


--
starguy
------------------------------------------------------------------------
starguy's Profile: http://www.excelforum.com/member.php...o&userid=32434
View this thread: http://www.excelforum.com/showthread...hreadid=551348

  #13   Report Post  
Posted to microsoft.public.excel.misc
Paul Lautman
 
Posts: n/a
Default Reversing characters of cells

starguy wrote:
thanks again for explaining. Infact when cell reference is different
then it would be tidy to change it in formula on frequent basis.


But then you either paste it in with the corrct offset or use Find & Replace


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
Add the same character(s) to multiple cells in a column (or row) . flashcatj Excel Discussion (Misc queries) 6 April 22nd 23 06:09 AM
find cells that contain specific characters mshornet Excel Worksheet Functions 8 November 23rd 05 02:02 PM
need to add/remove characters over thousands of cells Nadia Excel Discussion (Misc queries) 3 June 19th 05 11:38 PM
Convert data of cells to any type: Number, Date&Time, Text Kevin Excel Discussion (Misc queries) 0 December 30th 04 06:55 AM
linking cells in Excel 2003. How to not truncate to 255 characters. GarryFerg Excel Discussion (Misc queries) 5 December 8th 04 03:33 PM


All times are GMT +1. The time now is 11:21 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"