ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete everything after a certain character? (https://www.excelbanter.com/excel-programming/301852-delete-everything-after-certain-character.html)

Chris

Delete everything after a certain character?
 
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

Earl Kiosterud[_3_]

Delete everything after a certain character?
 
Chris,
=MID(A2,SEARCH("(",A2)+1,LEN(A2))
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Chris" wrote in message
...
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




sbell

Delete everything after a certain character?
 
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" wrote in message
...
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





All times are GMT +1. The time now is 05:08 AM.

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