Reversing a text and number string independent of upper or lower case

ER_Neha

Board Regular
Joined
Jul 25, 2020
Messages
121
Office Version
  1. 365
Platform
  1. Windows
Hello. I hope you are doing well. Thanks in advance.
I have a string, I want them to be reversed. I have given various formats of strings that contain text and number, I would be glad to get a solution in formula

Book1
AB
1stringsDesired output
2ABCDEFFEDCBA
3ABCCBA
4CATTAC
5doggod
6DoggoD
7DoggOD
8CAT123321TAC
9Cat5005taC
Sheet1
 

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
11,981
Office Version
  1. 365
Platform
  1. Windows
Try this in B2

=CONCAT(MID(A2,LEN(A2)-ROW(INDIRECT("1:"&LEN(A2)))+1,1))
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows
If you happen to have a lot of these formulas and wanted to avoid the volatile function INDIRECT you could use the col B alternative below.
I think that you may not yet have the SEQUENCE function in your Excel 365(?) but when you do you could also use the col C formula.
And if your strings are all short like your samples, you could even use something like the col D option.

20 08 23.xlsm
ABCD
1strings
2ABCDEFFEDCBAFEDCBAFEDCBA
3ABCCBACBACBA
4CATTACTACTAC
5doggodgodgod
6DoggoDgoDgoD
7DoggoDgoDgoD
8CAT123321TAC321TAC321TAC
9Cat5005taC05taC05taC
Reverse
Cell Formulas
RangeFormula
B2:B9B2=CONCAT(MID(A2,LEN(A2)-ROW(INDEX(A:A,1):INDEX(A:A,LEN(A2)))+1,1))
C2:C9C2=CONCAT(MID(A2,SEQUENCE(LEN(A2),,LEN(A2),-1),1))
D2:D9D2=CONCAT(MID(A2,{9,8,7,6,5,4,3,2,1},1))
 

ER_Neha

Board Regular
Joined
Jul 25, 2020
Messages
121
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

If you happen to have a lot of these formulas and wanted to avoid the volatile function INDIRECT you could use the col B alternative below.
I think that you may not yet have the SEQUENCE function in your Excel 365(?) but when you do you could also use the col C formula.
And if your strings are all short like your samples, you could even use something like the col D option.

20 08 23.xlsm
ABCD
1strings
2ABCDEFFEDCBAFEDCBAFEDCBA
3ABCCBACBACBA
4CATTACTACTAC
5doggodgodgod
6DoggoDgoDgoD
7DoggoDgoDgoD
8CAT123321TAC321TAC321TAC
9Cat5005taC05taC05taC
Reverse
Cell Formulas
RangeFormula
B2:B9B2=CONCAT(MID(A2,LEN(A2)-ROW(INDEX(A:A,1):INDEX(A:A,LEN(A2)))+1,1))
C2:C9C2=CONCAT(MID(A2,SEQUENCE(LEN(A2),,LEN(A2),-1),1))
D2:D9D2=CONCAT(MID(A2,{9,8,7,6,5,4,3,2,1},1))
Thank you so much I wanted to know all the ways to do it, glad you replied.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows
I wanted to know all the ways to do it
In that case there is also a very simple user-defined function too.

VBA Code:
Function Rev(s As String) As String
  Rev = StrReverse(s)
End Function

ER_Neha 1.xlsm
AB
1strings
2ABCDEFFEDCBA
3ABCCBA
4CATTAC
5doggod
6DoggoD
7DoggoD
8CAT123321TAC
9Cat5005taC
Reverse
Cell Formulas
RangeFormula
B2:B9B2=Rev(A2)
 

Watch MrExcel Video

Forum statistics

Threads
1,123,337
Messages
5,601,026
Members
414,422
Latest member
acegreen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top