[英]adding text in between a string in excel
I have a string that looks like this in one cell: 我有一个在一个单元格中看起来像这样的字符串:
Col1Col2Col3Col4Col5 Col1Col2Col3Col4Col5
it goes all the way to Col100. 它一直到Col100。
I want to use one formula without VBA and add a comma in between the Col to make the text look like this: 我想使用一个没有VBA的公式,并在Col之间添加一个逗号,使文本看起来像这样:
Col1,Col2,Col3,Col4,Col5 COL1,col2的,COL3,COL4,COL5
again all the way to Col100. 再一次到Col100。
I'm thinking some kind of find replace function in excel? 我在考虑在excel中找到一些替换函数?
As a formula: 作为一个公式:
=LEFT(A1,1)&SUBSTITUTE(MID(A1,2,1024),"Col",",Col")
1024 is an assumed maximum number of characters in a cell. 1024是单元中假设的最大字符数。
If not every cell contains this text then you could only substitute if the cell begins with "Col": 如果不是每个单元格都包含此文本,那么只能在单元格以“Col”开头时替换:
=IF(LEFT(A1,3)="Col",LEFT(A1,1)&SUBSTITUTE(MID(A1,2,255),"Col",",Col"),A1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.