character extraction and replacement

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
 
P

Peo Sjoblom

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)
 
D

Don Guillett

try

Sub replace1stchar()
For Each c In range("a2:a22")'Selection
c.Value = "#" & Right(c, Len(c) - 1)
Next
End Sub
 
H

Harlan Grove

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,"#")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top