Reputation: 147
Is there a cell formula I can use to produce the following with some SUBSTITUTE functions?
I've got data in a cell like:
sun, sky, cloud, clouds
and I'm trying to wrap each value in quotation marks to give me
"sun", "sky", "cloud", "clouds"
I'm struggling as there are multiple values.
Upvotes: 2
Views: 1180
Reputation: 34180
I think this is enough - plz let me know if there is a case I haven't thought of:
=regexreplace(A1,"(\w+)","""$1""")
So Regexreplace works in a similar way to Substitute, but lets you specify what is to be replaced using a regular expression
In this example:
Rexegg.com is a useful reference.
You could modify this to include sun-screen and cloud's if you wanted to:
=regexreplace(A1,"([\w'-]+)","""$1""")
Upvotes: 2
Reputation: 7773
I think this should work:
=CHAR(34)&SUBSTITUTE(A1,", ",CHAR(34)&", "&CHAR(34))&CHAR(34)
with your data in cell A1. That will only work if you have spaces after each comma in the original data.
Upvotes: 2