Google-sheets – Replacing items in comma delimited cell with same string each time

formulasgoogle sheetsgoogle-sheets-arrayformularegex

I'm trying to create a formula that will replace any contents of comma delimited cell with single string. The number of items in delimited cell will vary…

Specifically:

524352435,2345235523,2345235235,sfdsfsdsf,423534534 needs to become 1,1,1,1,1

1231231,bbssdds,464574745 needs to become 1,1,1

Any thoughts greatly appreciated. Thanks

Best Answer

You can try the following

=ArrayFormula(REGEXREPLACE($Q26:Q,"\w+","1"))

(Please adjust ranges to your needs)

enter image description here