Copy text after last comma in cell

Juleew

New Member
Joined
Nov 24, 2009
Messages
45
I am using excel 2007, I have a column of cells that contain text that is separated by commas. Each cell may have 3 commas or 5 or 2 commas. What I need to do is copy the last text after the last comma in the cell.

example
xxx,yyy,zzz copy to another cell the text zzz
xxx,yyy copy to another cell the text yyy
xxx,yyy,zzz,aaa copy to another cell the text aaa

:confused:
 
If you want to put the result in another cell, give this formula a try:

=REPLACE(A1,1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-1,"")
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
One more formula: =SUBSTITUTE(TRIM(SUBSTITUTE(A1,","," "))," ",",")
 
Upvote 0
Example

Row A
1. apple,boy,cat,day,eat
2. eye,floor,good,help
3. pick,query,rose,sun,toy
4. x,y,z

I Want To Split Last Word or Last Comma Of Each Row Data

Row A | Row B
1. apple,boy,cat,day | eat
2. eye,floor,good | help
3. pick,query,rose,sun | toy
4. x,y | z
 
Last edited:
Upvote 0
I have a similar question.


  • I need to extract EACH value within a comma-delimited series .
  • I do not know exactly how many items will appear within a series, but I know it will always be 10 or fewer.
  • I do not know the number of characters of any of the values.

Example:

COL A
Apple, Banana, Pear
Banana, Watermelon, Grape
Grape, Lemon, Watermelon, Kiwi
Lemon, Lime, Kiwi, Pear

<tbody>
</tbody>

I'd like the following to be returned in columns B through whatever.


COL ACOL BCOL CCOL DCOL ECOL F
Apple, Banana, PearAppleBananaPear
Banana, Watermelon, GrapeBananaWatermelonGrape
Grape, Lemon, Watermelon, KiwiPearLemonWatermelonKiwi
Lemon, Lime, Kiwi, PearLemonLimeKiwiPear

<tbody>
</tbody>

I figure I'll need to use the FIND(), MID(), and TRIM() functions, but I can't seem to figure it out.

Thanks,

Shawn
 
Upvote 0
Assuming your data in Column A starts on Row 1, put this formula in cell B1 and copy it across for as many columns as you think you might ever need to fill, then copy all of those cells down to the bottom of your data...

=TRIM(MID(SUBSTITUTE(", "&$A1,", ",REPT(" ",300)),COLUMNS($B:B)*300,300))
 
Upvote 0
I have no spaces after the commas, so with a little tweaking that worked perfectly. I now see the data separated out. My next step is figuring out how to turn this into a pie chart. Thanks!
 
Upvote 0
I have no spaces after the commas, so with a little tweaking that worked perfectly.
Your example data showed a space after the comma which is why I included the space along with the comma as the delimiter... you should be careful to show us what you actually have when asking questions in a forum (remember, the people you are asking to help you only know what you show or tell us, nothing more, nothing less).
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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
Back
Top