string 从列数据中删除字符串的开头部分

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9460035/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 01:24:49  来源:igfitidea点击:

Remove beginning part of a string from column data

stringexcel

提问by Cipher

I have an excel file in which there are 10 columns with the data starting from:

我有一个 excel 文件,其中有 10 列的数据从:

Text1 | Text4 | Text7
Text2 | Text5 | Text8
Text3 | Text6 | Text9

For my requirement, I have to remove the part Textfrom all these cells. How is this done in Excel? I am a complete newbie to this.

根据我的要求,我必须Text从所有这些单元格中移除零件。这是如何在 Excel 中完成的?我是一个完全的新手。

回答by brettdj

You can do this directly with your data without formula

您可以直接使用您的数据执行此操作,无需公式

Manually

手动

  • Select the area of interest
  • Press Ctrl & F to bring up the Find and Replace dialog
  • Select the ‘Replace' tab
  • Under ‘Find what' put Text, leave ‘Replace With' blank
  • Ensure ‘Match entire cell content' is unchecked
  • 选择感兴趣的领域
  • 按 Ctrl & F 调出查找和替换对话框
  • 选择“替换”选项卡
  • 在“查找内容”下Text,将“替换为”留空
  • 确保取消选中“匹配整个单元格内容”

sample

样本

VBA

VBA

Selection.Replace "Text", vbNullString, xlPart

Selection.Replace "Text", vbNullString, xlPart

回答by Caleb Hattingh

Use a formula:

使用公式:

=VALUE(SUBSTITUTE(A1,"Text",""))

回答by everconfusedGuy

Assuming the first cell is A1 type this in the formula bar = Mid(A1, 5, Len(A1) -4) you can fill series for the other cells.

假设第一个单元格是 A1,在公式栏中键入此 = Mid(A1, 5, Len(A1) -4) 您可以为其他单元格填充系列。

回答by Ben

Find and replace tool works well, if the "text" varies though it will no longer work. For future people looking for a fix for a similar problem but where the text is different then you just place " *" in the find what box then replace. (don't use the quote marks but do put in a space before the *)

查找和替换工具运行良好,如果“文本”发生变化,但它将不再起作用。对于未来寻找类似问题修复程序但文本不同的人,您只需在查找内容框中放置“*”然后替换即可。(不要使用引号,但要在 * 前加一个空格)

This removes any entry after the text. swapping the * and the space will remove any text before the space.

这将删除文本后的任何条目。交换 * 和空格将删除空格之前的任何文本。