ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   text to columns (https://www.excelbanter.com/excel-discussion-misc-queries/228687-text-columns.html)

bwduncan

text to columns
 
I've exported a worksheet that put are customer id # and name in the same
column.
Of course our customer id aren't all the same length and some of the names
also have a "-" in them. Is there a way to seperate this by the first hyphen
only and to disregard the second one?

Rick Rothstein

text to columns
 
This formula will display the text to the left of the first dash...

=LEFT(A1,FIND("-",A1&"-")-1)

And this formula will return all the text after that first dash...

=MID(A1,FIND("-",A1&"-")+1,99)

The second formula assumes your entries are not longer than 99 characters.
If they could be longer, just change the 99 to 999 instead. Oh, and these
formulas can be copied down as needed.

--
Rick (MVP - Excel)


"bwduncan" wrote in message
...
I've exported a worksheet that put are customer id # and name in the same
column.
Of course our customer id aren't all the same length and some of the names
also have a "-" in them. Is there a way to seperate this by the first
hyphen
only and to disregard the second one?




All times are GMT +1. The time now is 07:32 PM.

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