trimng text

Phil-e

Board Regular
Joined
Jun 28, 2004
Messages
65
Is there a way to trim text strings after a comma(,). To avoid a lot of typing I need to copy and past from one sheet to another. The problem is that in the cell on the "copy sheet" it has (lastname, firstname middleinitial.) I only want the (lastname) pasted in the new sheet/cell. I need to cut every thing past the comma. Any ideas? :confused: THANKS
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,270
Maybe this will help, this formula will return whatever is in the cell to the left of the comma, A1 for example:

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

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Hi

Assuming the data is in A4 then

Left(Range("a4"), InStr(1, Range("a4"), ",") - 1)
will get all the data to the left of the comma. If you want to include the comma, then remove the -1.


Tony
 

Phil-e

Board Regular
Joined
Jun 28, 2004
Messages
65
Thanks Tom & ACE, that was quick. Just what I needed. Somtimes you can't see the forest for the trees.
Phil
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,052
Messages
5,835,142
Members
430,343
Latest member
Sailingexcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top