ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   replace numbers with X (https://www.excelbanter.com/excel-discussion-misc-queries/77569-replace-numbers-x.html)

davids

replace numbers with X
 
I'm relatively new to Excel I'm wondering if there is a formula i can use
that replaces the last four numbers in a sequence with "X" no matter the
length of the sequence eg:

149876 14xxxx
1234789 123xxxx

This is not like the social security number where the amount of numbers is
fixed they are varying lengths. Thank you

daddylonglegs

replace numbers with X
 

one way would be

=REPLACE(A1,LEN(A1)-3,4,"xxxx")


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=522896


bpeltzer

replace numbers with X
 
=left(trim(a1),len(a1)-4)&"xxxx"

"davids" wrote:

I'm relatively new to Excel I'm wondering if there is a formula i can use
that replaces the last four numbers in a sequence with "X" no matter the
length of the sequence eg:

149876 14xxxx
1234789 123xxxx

This is not like the social security number where the amount of numbers is
fixed they are varying lengths. Thank you


davids

replace numbers with X
 
Apologies I need it to replace the first four digits with X
eg Account number = 123456 outcome I require is XXXX56

"daddylonglegs" wrote:


one way would be

=REPLACE(A1,LEN(A1)-3,4,"xxxx")


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=522896



daddylonglegs

replace numbers with X
 

Try

=REPLACE(A1,1,4,"xxxx")


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=522896


George

replace numbers with X
 
Just alter daddylonglegs formula

From =REPLACE(A1,LEN(A1)-3,4,"xxxx") Last 4
To =REPLACE(A1,1,4,"xxxx") First 4

George

davids wrote:
Apologies I need it to replace the first four digits with X
eg Account number = 123456 outcome I require is XXXX56

"daddylonglegs" wrote:


one way would be

=REPLACE(A1,LEN(A1)-3,4,"xxxx")


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=522896




All times are GMT +1. The time now is 07:08 PM.

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