ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I replace last numeric string from a alphanumeric string? (https://www.excelbanter.com/excel-discussion-misc-queries/104376-how-do-i-replace-last-numeric-string-alphanumeric-string.html)

Christy

How do I replace last numeric string from a alphanumeric string?
 
For example,
I want to replace "1055428" from CC03TW05040000010001055428 with "1162123",
so that my string would be CC03TW05040000010001162123.

Thanks!

Zamdrist

How do I replace last numeric string from a alphanumeric string?
 
Christy wrote:
For example,
I want to replace "1055428" from CC03TW05040000010001055428 with "1162123",
so that my string would be CC03TW05040000010001162123.

Thanks!


Is the last set of characters consistently 7 characters? If so...

sString = Left("CC03TW05040000010001055428",
Len("CC03TW05040000010001055428") -7) & "1162123"

"1162123" could be a variable or a field value too.

If it is not consistently 7 characters...maybe 1000 is? In which case
you could use the Mid function.

Steve


VBA Noob

How do I replace last numeric string from a alphanumeric string?
 

Hi,

Say

A1 = CC03TW05040000010001055428
B1 = 1162123

then enter C1

=LEFT(A5,LEN(A5)-LEN(B5))&B5

VBA Noob


--
VBA Noob
------------------------------------------------------------------------
VBA Noob's Profile: http://www.excelforum.com/member.php...o&userid=33833
View this thread: http://www.excelforum.com/showthread...hreadid=570561


Christy

How do I replace last numeric string from a alphanumeric string?
 


Bingo!
Thanks a lot guys. You guys are incredible.


All times are GMT +1. The time now is 04:32 PM.

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