[英]Excel: replace part of cell's string value
I have a large spreadsheet with a column called "Roles". 我有一个大型电子表格,其中包含一个名为“角色”的列。 In this columns are values like: 在此列中的值如下:
ROLES
Author
Author;
Publishing; Author;
Something Else; Author; Publishing
There are other columns where the word "Author" may exist. 还有其他列可能存在“作者”一词。
What I need to do is look for "Author" in my "Roles" column only, and replace it with "Authoring", without losing anything before or after it. 我需要做的是仅在我的“角色”列中查找“作者”,并将其替换为“创作”,而不会在其之前或之后丢失任何内容。 ie the end result should be: 即最终结果应该是:
ROLES
Authoring
Authoring;
Publishing; Authoring;
Something Else; Authoring; Publishing
I tried the FIND
- and REPLACE
-functions, but that replaced the entire cell value, not just a portion of it. 我尝试了FIND
- 和REPLACE
functions,但是它取代了整个单元格值,而不仅仅是它的一部分。
=IF(FIND("Author",[@Roles],1),REPLACE("Author",1,6,"Authoring"))
Can anyone help? 有人可以帮忙吗? I'd rather not us a VB solution, as I'm not familiar with how to do that, so hopefully there is a formula based way? 我宁愿不是我们的VB解决方案,因为我不熟悉如何做到这一点,所以希望有一个基于公式的方式?
what you're looking for is SUBSTITUTE: 您要找的是SUBSTITUTE:
=SUBSTITUTE(A2,"Author","Authoring")
Will substitute Author for Authoring without messing with everything else 将替换Author for Authoring而不会弄乱其他所有内容
What you need to do is as follows: 你需要做的是如下:
That's it! 而已!
I know this is old but I had a similar need for this and I did not want to do the find and replace version. 我知道这是旧的,但我对此有类似的需求,我不想做查找和替换版本。 It turns out that you can nest the substitute method like so: 事实证明你可以像这样嵌套替代方法:
=SUBSTITUTE(SUBSTITUTE(F149, "a", " AM"), "p", " PM")
In my case, I am using excel to view a DBF file and however it was populated has times like this: 在我的情况下,我使用excel来查看DBF文件,但是它已经填充了这样的时间:
9:16a
2:22p
So I just made a new column and put that formula in it to convert it to the excel time format. 所以我刚刚制作了一个新专栏并将其放入其中,将其转换为excel时间格式。
You have a character = STQ8QGpaM4CU6149665!7084880820
, and you have a another column = 7084880820
. 你有一个字符= STQ8QGpaM4CU6149665!7084880820
,你有另一列= 7084880820
。
If you want to get only this in excel using the formula: STQ8QGpaM4CU6149665!
如果你想使用公式只在excel中得到这个: STQ8QGpaM4CU6149665!
, use this: , 用这个:
=REPLACE(H11,SEARCH(J11,H11),LEN(J11),"")
H11 is an old character and for starting number use search option then for no of character needs to replace use len option then replace to new character. H11是一个旧字符,并且对于起始号码使用搜索选项,然后对于没有字符需要替换使用len选项然后替换为新字符。 I am replacing this to blank. 我将此替换为空白。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.