Excel查找并替换字符串中的子字符串

时间:2021-08-14 19:26:00
String is "TABLE1[ROW1]"

Using Find and Replace the substring "TABLE1" should be replaced such that [ROW1] is retained after replacement.

使用查找和替换子字符串“TABLE1”应该被替换掉,以便在替换后保留[ROW1]。

Final String after replacement

后最终字符串替换

INDIRECT(D1&"[ROW1]")

I am having trouble with inserting ") After [ROW1].

我在插入方面有困难")后[第1行]。

I have seen some samples for retaining using "^&", but no solution to this problem.

我看过一些样品保留使用“^ &”,但没有解决这个问题。

Kindly Help. Thanks.

请帮助。谢谢。

1 个解决方案

#1


1  

Having cell A1 containing the string TABLE1[ROW1], using Excel worksheet function SUBSTITUTE as following: =SUBSTITUTE(A1,"TABLE1", ""), then adding the word "INDIRECT(D1&" resulting in the cell A2 formula:

使用Excel工作表函数替换为:=替换(A1,“TABLE1”,“”),然后将“间接”(D1&)添加到单元格A2公式中:

="INDIRECT(D1&" & """" & SUBSTITUTE(A1,"TABLE1", "") & """" & ")",

=“间接(d1”和“”“”和替代(A1,“表1”,“”)和“”“”和“)”,

transforming the original string TABLE1[ROW1] into the string: INDIRECT(D1&"[ROW1]") as per your requirement.

将原始字符串TABLE1[ROW1]转换为字符串:间接(D1&"[ROW1])按您的要求。

Hope this will help. Rgds

希望这将帮助。祝好

#1


1  

Having cell A1 containing the string TABLE1[ROW1], using Excel worksheet function SUBSTITUTE as following: =SUBSTITUTE(A1,"TABLE1", ""), then adding the word "INDIRECT(D1&" resulting in the cell A2 formula:

使用Excel工作表函数替换为:=替换(A1,“TABLE1”,“”),然后将“间接”(D1&)添加到单元格A2公式中:

="INDIRECT(D1&" & """" & SUBSTITUTE(A1,"TABLE1", "") & """" & ")",

=“间接(d1”和“”“”和替代(A1,“表1”,“”)和“”“”和“)”,

transforming the original string TABLE1[ROW1] into the string: INDIRECT(D1&"[ROW1]") as per your requirement.

将原始字符串TABLE1[ROW1]转换为字符串:间接(D1&"[ROW1])按您的要求。

Hope this will help. Rgds

希望这将帮助。祝好