DeExcelerated
New Member
- Joined
- Mar 28, 2019
- Messages
- 5
Hi All,
How do I add an "Oxford" comma?
From the example below, the formula =SUBSTITUTE(REPLACE(REPT(", "&A2,A2<>"")&REPT(", "&B2,B2<>"")&REPT(", "&C2,C2<>"")&REPT(", "&D2,D2<>"")&REPT(", "&E2,E2<>"")&REPT(", "&F2,F2<>""),1,2,""),", "," and ",MAX(1,COUNTIF($A2:$F2,"?*")-1)) works but does not add a comma before the "and" delimiter on two or more values (as shown below):
Huggy Bear = Huggy Bear
Huggy Bear Mamma Bear = Huggy Bear and Mamma Bear
Huggy Bear Mamma Bear Brother Bear = Huggy Bear, Mamma Bear, and Brother Bear
Huggy Bear Mamma Bear Brother Bear Sister Bear = Huggy Bear, Mamma Bear, Brother Bear, and Sister Bear
Huggy Bear Mamma Bear Brother Bear Sister Bear Errant Bear = Huggy Bear, Mamma Bear, Brother Bear, Sister Bear, and Errant Bear
Huggy Bear Mamma Bear Brother Bear Sister Bear Errant Bear Baby Bear = Huggy Bear, Mamma Bear, Brother Bear, Sister Bear, Errant Bear, and Baby Bear
Any suggestions?
How do I add an "Oxford" comma?
From the example below, the formula =SUBSTITUTE(REPLACE(REPT(", "&A2,A2<>"")&REPT(", "&B2,B2<>"")&REPT(", "&C2,C2<>"")&REPT(", "&D2,D2<>"")&REPT(", "&E2,E2<>"")&REPT(", "&F2,F2<>""),1,2,""),", "," and ",MAX(1,COUNTIF($A2:$F2,"?*")-1)) works but does not add a comma before the "and" delimiter on two or more values (as shown below):
Huggy Bear = Huggy Bear
Huggy Bear Mamma Bear = Huggy Bear and Mamma Bear
Huggy Bear Mamma Bear Brother Bear = Huggy Bear, Mamma Bear, and Brother Bear
Huggy Bear Mamma Bear Brother Bear Sister Bear = Huggy Bear, Mamma Bear, Brother Bear, and Sister Bear
Huggy Bear Mamma Bear Brother Bear Sister Bear Errant Bear = Huggy Bear, Mamma Bear, Brother Bear, Sister Bear, and Errant Bear
Huggy Bear Mamma Bear Brother Bear Sister Bear Errant Bear Baby Bear = Huggy Bear, Mamma Bear, Brother Bear, Sister Bear, Errant Bear, and Baby Bear
Any suggestions?