Google-sheets – Duplicate then concatenate in Google Spreadsheets

concatenategoogle sheets

How do I join a to both sides of : to result in a:a?

I could use something like =join(":","a","a"), but in this case, my "a" is another formula and it is very long. I'm trying to find a way so I don't have to write the formula twice.

Something like

=join(":",rept("a",2)) → but this produces aa

Best Answer

Try this formula.

Formula

=REGEXREPLACE(REPT(A1 & ":",2),".$","")

Explained

First the following string is being repeated twice: RESULT_OF_A1 combined with a semicolon. The last semicolon in this repetition is being removed by the REGEXREPLACE formula. It simply replaces the last character by an empty space. The result of your formula is being used only once.