replace numbers with X

D

davids

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
 
D

davids

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

George

Just alter daddylonglegs formula

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

George
 
Top