ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I program a 'roll' of text, eg ABCD - BCDA. (https://www.excelbanter.com/excel-programming/309051-how-can-i-program-roll-text-eg-abcd-bcda.html)

Jonny JetSet

How can I program a 'roll' of text, eg ABCD - BCDA.
 
Please Help!!!

I would like to use a spreadsheet to program a 'roll' of text.

Examples: ABCD to roll to BCDA and ABCD to roll toCDAB.

I am using Microsoft Office 2003 - Excel 2003.



Niek Otten

How can I program a 'roll' of text, eg ABCD - BCDA.
 
I assume your second ABCD should read BCDA.

=RIGHT(A1,LEN(A1)-1)&LEFT(A1,1)

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Jonny JetSet" <Jonny wrote in message
...
Please Help!!!

I would like to use a spreadsheet to program a 'roll' of text.

Examples: ABCD to roll to BCDA and ABCD to roll toCDAB.

I am using Microsoft Office 2003 - Excel 2003.





Jack Schitt

How can I program a 'roll' of text, eg ABCD - BCDA.
 
=RIGHT(A1,LEN(A1)-1)&LEFT(A1,1)

Where ABCD is in cell A1

--
Return email address is not as DEEP as it appears
"Jonny JetSet" <Jonny wrote in message
...
Please Help!!!

I would like to use a spreadsheet to program a 'roll' of text.

Examples: ABCD to roll to BCDA and ABCD to roll toCDAB.

I am using Microsoft Office 2003 - Excel 2003.





Tom Ogilvy

How can I program a 'roll' of text, eg ABCD - BCDA.
 
this only accepts a positive number to roll

Public Function RollText(sStr As String, num As Long)
Dim i As Long, j As Long, k As Long
Dim sStr1 As String
k = Len(sStr)
j = 1 + num Mod k
For i = 1 To Len(sStr)
If j k Then j = 1
sStr1 = sStr1 & Mid(sStr, j, 1)
j = j + 1
Next
RollText = sStr1
End Function

=rolltext("ABCD",1)
would give BCDA

this doesn't loop:

Public Function RollText1(sStr As String, num As Long)
Dim i As Long, j As Long, k As Long
Dim sStr1 As String
k = Len(sStr)
j = 1 + num Mod k
sStr1 = Right(sStr, k - j + 1) & Left(sStr, j - 1)
RollText1 = sStr1
End Function

--
Regards,
Tom Ogilvy

"Jonny JetSet" <Jonny wrote in message
...
Please Help!!!

I would like to use a spreadsheet to program a 'roll' of text.

Examples: ABCD to roll to BCDA and ABCD to roll toCDAB.

I am using Microsoft Office 2003 - Excel 2003.






All times are GMT +1. The time now is 12:36 AM.

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