简体   繁体   English

检查 B 列是否包含 A 列中存在的特定字符串,然后将其从 B 列中的单元格中删除

[英]Check if column B contains a specific string that exists in column A and then remove it from the cell in column B

So I want either an excel function or VBA script that searches through column B for a specific string that exists in column A, and then once there's a match I want to remove that string from the cell in column B and return the rest of the cell contents into column C.所以我想要一个 excel 函数或 VBA 脚本,它在 B 列中搜索 A 列中存在的特定字符串,然后一旦匹配,我想从 B 列中的单元格中删除该字符串并返回单元格的其余部分C 列的内容。

I can't use a simple "find and replace" because, as you can see in the picture, the text in each of the cells is in the form of an ID with an underscore followed by a random number appended to it.我不能使用简单的“查找和替换”,因为正如您在图片中看到的,每个单元格中的文本都是带有下划线的 ID 形式,后跟一个随机数。 And I have around 100,000 rows to search through.我有大约 100,000 行要搜索。

An example table of what I'd like is shown below:我想要的示例表如下所示:

示例表

If the values you want to remove all have the pattern TL_xxxx you can use wildcards to replace them.如果要删除的值都具有模式TL_xxxx ,则可以使用通配符替换它们。

Ctrl-H to open the Find and Replace dialog, put TL_???? Ctrl-H 打开查找和替换对话框,输入TL_???? into the Find what box and leave the Replace with box blank.进入Find what框并将Replace with框留空。

You may need a second pass to replace two spaces or two line breaks with just one.您可能需要第二遍才能将两个空格或两个换行符替换为一个。

暂无
暂无

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

相关问题 如果A列包含文本,则将值从B列中的单元格复制到B列中的相应项目 - If column A contains text, copy value from cell in Column B to corresponding item in Column B 如果B列的单元格值包含A单元格值 - If column B cell value contains A cell value Countifs列A包含“字符串”,列B以“ 0”开头 - Countifs column A contains “String” & column B starts with “0” EXCEL 如何检查A列是否包含特定值,B列是否包含2个特定值? - EXCEL How to check if Column A contains specific value and Column B contains 2 specific values? 检查B列中的下一个空行,并将字符串粘贴到相应的A单元格中 - Check for next empty row in column B and paste string into corresponding A Cell 对于a列=特定值的所有实例,请检查b列是否包含文本 - For all instances where column a = specific value, check if column b contains text VBA - 在 A 列中查找重复项,然后检查 B 列中是否有单元格值 - VBA - Find Duplicates in Column A and then check to see if there a cell value in Column B 更改B列A列的单元格值等于特定文本 - Change cell value of column A of column B is equal to specific text 如果C列中存在B列值,则将B列中的字符串的字体更改为粗体 - If column B value exists in column C then change the font of the string in column B to Bold 检查文本列A中的字符串,并返回列B中的另一个字符串-Excel - Check for string in text column A, return another string in column B - Excel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM