character extraction and replacement

  • Thread starter Thread starter fazlici
  • Start date Start date
F

fazlici

Hello,
I am trying to extract the first character in a string (in a cell) an
replace it with a #. I have tried using LEFT and REPLACE but I seem t
be missing something.

Any assistance would be greatly appreciated.

Thank you,
Ja
 
A couple of ways

=SUBSTITUTE(A1,LEFT(TRIM(A1)),"#",1)

="#"&RIGHT(TRIM(A1),LEN(TRIM(A1))-1)

--

Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)
 
try

Sub replace1stchar()
For Each c In range("a2:a22")'Selection
c.Value = "#" & Right(c, Len(c) - 1)
Next
End Sub
 
fazlici > said:
I am trying to extract the first character in a string (in a cell) and
replace it with a #. I have tried using LEFT and REPLACE but I seem to
be missing something.
....

You shouldn't need LEFT. Try

=REPLACE(A1,1,1,"#")
 
Back
Top