Commas and and symbol insertion

rzarcta

New Member
Joined
Jan 27, 2019
Messages
2
I have some data in columns that is separated by commas:

person1, person 2, person3, person4, person5
person6, person7, person8
person44, person9, person10, person 99
etc.

I want to be able to insert an "and" after the last comma so it would read:

person1, person 2, person3, person4, and person5
person6, person7, and person8
person44, person9, person10, and person 99

I used text to columns and then sorted by the number of columns newly created and then inputted & statements with "," and "and" based on the number of entries each row had. it worked but it was quite tedious considering I have thousands of rows.

Is there an easier way to do this?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try

Code:
=SUBSTITUTE(A1,", "," and ",LEN(A1)-LEN(SUBSTITUTE(A1,",","")))
 
Upvote 0
This is without the Oxford comma
=SUBSTITUTE(A1,",", " and", LEN(A1)-LEN(SUBSTITUTE(A1,",","")))

This is with
=SUBSTITUTE(A1,",", ", and", LEN(A1)-LEN(SUBSTITUTE(A1,",","")))
 
Upvote 0
This is without the Oxford comma
=SUBSTITUTE(A1,",", " and", LEN(A1)-LEN(SUBSTITUTE(A1,",","")))

This is with
=SUBSTITUTE(A1,",", ", and", LEN(A1)-LEN(SUBSTITUTE(A1,",","")))


Thanks! This works amazingly well! You are a life saver...
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,249
Members
448,879
Latest member
oksanana

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