Delete everything after a certain character?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Anyone have a formula or vb code that will delete everything from cell A1 after a certain character (ie "(" ) and populate cell B1 with what remains?

TIA
-Chris
 
Chris,
=MID(A2,SEARCH("(",A2)+1,LEN(A2))
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

Chris said:
Anyone have a formula or vb code that will delete everything from cell A1
after a certain character (ie "(" ) and populate cell B1 with what remains?
 
Chris,

In code you can use Instr(1, str1, str 2) to locate you character. And
inbed this in a Left(str 1, Instr()-1) to get your string.
Range("A2") = Left(Range("A1"), InStr(1, Range("A1"), "(") - 1)

hth
--
steveb
(Remove 'NoSpam' from email address if replying direct)
Chris said:
Anyone have a formula or vb code that will delete everything from cell A1
after a certain character (ie "(" ) and populate cell B1 with what remains?
 
Back
Top