ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace last three characters (https://www.excelbanter.com/excel-programming/405981-replace-last-three-characters.html)

Phillips via OfficeKB.com

Replace last three characters
 
Hiya! i was wondering if there was a way to replace just the last three
characters in a cell? example i have 123456000 i would like to have instead
of the 000 a 959 so it would be 123456959? any ideas?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200802/1


ToddEZ

Replace last three characters
 
try the replace function. Use use the formula helper box for the context.

=Replace()

"Phillips via OfficeKB.com" wrote:

Hiya! i was wondering if there was a way to replace just the last three
characters in a cell? example i have 123456000 i would like to have instead
of the 000 a 959 so it would be 123456959? any ideas?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200802/1



Ron Rosenfeld

Replace last three characters
 
On Tue, 12 Feb 2008 16:24:05 GMT, "Phillips via OfficeKB.com" <u27679@uwe
wrote:

Hiya! i was wondering if there was a way to replace just the last three
characters in a cell? example i have 123456000 i would like to have instead
of the 000 a 959 so it would be 123456959? any ideas?



=REPLACE(A1,LEN(A1)-2,3,959)

This returns a text string, so you may want to precede it with a double unary
to convert it back to a number:

=--REPLACE(A1,LEN(A1)-2,3,959)

If the values are always numbers, you could use this:

=INT(A1/1000)*1000+959


--ron

Phillips via OfficeKB.com

Replace last three characters
 
thanks!!!

Ron Rosenfeld wrote:
Hiya! i was wondering if there was a way to replace just the last three
characters in a cell? example i have 123456000 i would like to have instead
of the 000 a 959 so it would be 123456959? any ideas?


=REPLACE(A1,LEN(A1)-2,3,959)

This returns a text string, so you may want to precede it with a double unary
to convert it back to a number:

=--REPLACE(A1,LEN(A1)-2,3,959)

If the values are always numbers, you could use this:

=INT(A1/1000)*1000+959

--ron


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200802/1



All times are GMT +1. The time now is 10:45 PM.

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