简体   繁体   English

将x // y转换为x / y“ Excel

[英]Converting x//y into x/y" Excel

I'm looking for a solution to convert a text stored in an Excel cell from, 我正在寻找一种解决方案,可以将存储在Excel单元格中的文本转换为

x//y

into 进入

x/y"

(preferably using serach and replace if possible) (最好使用serach并在可能的情况下进行替换)

Values of x & y will keep changing from cell to cell however pattern will be the same. xy的值将在单元格之间不断变化,但是模式将相同。
I am using Excel 2007. A VBA solution if any will be fine also. 我正在使用Excel2007。如果有VBA解决方案,也可以。

Try =CONCATENATE(SUBSTITUTE(C2,"//","/",1),"""") 尝试= CONCATENATE(SUBSTITUTE(C2,“ //”,“ /”,1),“”“”)

Something like above works? 像上面的作品?

No VBA Required. 不需要VBA。 Try this Excel formula 试试这个Excel公式

=MID(A1,1,FIND("//",A1,1)-1)&"/"&MID(A1,FIND("//",A1,1)+2,LEN(A1)-FIND("//",A1,1)-1)&""""

Explanation 说明

  1. =MID(A1,1,FIND("//",A1,1)-1) will give you X from X//Y =MID(A1,1,FIND("//",A1,1)-1)X//Y给您X
  2. =MID(A1,FIND("//",A1,1)+2,LEN(A1)-FIND("//",A1,1)-1) will give you Y =MID(A1,FIND("//",A1,1)+2,LEN(A1)-FIND("//",A1,1)-1)将给您Y

Use next pattern of RegEx for replacing // 使用下一个RegEx模式替换//

\\/\\/(\\w+)

with /$1" /$1"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM