简体   繁体   English

如何检查单元格中的实际文本是否已经存在于Excel中的列中

[英]How to check if the actual text in the cell already exists in the column in excel

I'm editing an excel workbook who contains a lot of formulas and this workbook register products with a serial key, and product number... But I have some problems with it, because when the user are registering a product (with the serial code, and the product number) the product number always gonna be the same (I already have it, this is not the problem).. 我正在编辑一个包含许多公式的excel工作簿,并且此工作簿使用序列号和产品编号注册产品。但是我有一些问题,因为当用户注册产品时(使用序列号) ,以及产品编号)产品编号将始终相同(我已经拥有了,这不是问题)。

The problem is when the user register the serial of the product, this serial can not be repeated in the workbook (column B), so I want that when the user introduce the serial, excel record all serials of the same column, and If in the column are another product with the same serial, excel gonna show a messageBox with the error, and the user gonna introduce another serial in the same row... 问题是当用户注册产品的序列号时,该序列号不能在工作簿中重复(列B),因此我希望当用户介绍序列号时,excel记录同一列的所有序列号,如果在该列是具有相同序列号的另一个产品,excel将显示带有错误的messageBox,并且用户将在同一行中引入另一个序列号...

I don't know a lot of excel, but the program that I'm editing have messagebox if the user do some error.. 我不了解很多excel,但是如果用户执行某些错误,则我正在编辑的程序会显示消息框。

Thank you, and sorry for my English. 谢谢,对不起我的英语。

Maybe this will help. 也许这会有所帮助。 Good luck! 祝好运! Using for and while loops in Excel 在Excel中使用for和while循环

Edit: You can compare cells to each other. 编辑:您可以相互比较单元格。 I suggest using two while-loops (each using a count variable) that continue until a cell is empty. 我建议使用两个while循环(每个循环使用一个count变量),直到单元格为空。 The first variable (for example i) could be used to compare is to a second variable (for example j). 第一个变量(例如i)可用于与第二个变量(例如j)进行比较。 Increment these when you have made the necessary comparisons. 进行必要的比较后,增加这些值。

Select column B and click data validation. 选择column B ,然后单击数据验证。

Use the below formula under custom, 在自定义下使用以下公式,

=COUNTIF(B:B,B1)=1

This formula searches the number entered throughout the column B . 此公式搜索在column B输入的数字。 It will error out if the value is present already on the same column. 如果该值已经存在于同一列上,则会出错。 Let me know if you need anything else 需要帮助请叫我

暂无
暂无

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

相关问题 Excel:检查列中是否已存在单元格值,然后减去并显示另一个值 - Excel: Check if cell value already exists in column, and then substract and show another value 如何检查元素是否存在于列中,然后在特定单元格中插入带有文本的正方形 - How to check if an element exists in a column, and then insert a square with text in a certain cell EXCEL:检查是否在另一列中找到单元格文本 - EXCEL: Check if cell text is found in another column 如何将单元格文本与包含Excel中已有文本的另一个单元格合并? - How to join a cell text with another cell that contains text already in excel? 跳过已经有一些文本的单元格后如何在excel列中填充系列 - How to fill series in the column of excel after skipping the cell (s) which already have some text 如何检查excel中单元格内是否有特定文本 - How to check if there is a specific text inside a cell in excel 检查其他多个工作表上是否存在excel单元格值-如果是,则返回存在于另一列中的工作表名称 - Check if an excel cell value exists on multiple other sheets - and if so return the name of the sheet it exists on in another column Excel:检查列中是否存在单元格字符串值,并获取对该字符串的所有单元格引用 - Excel: Check if cell string value exists in column, and get all cell references to that string 检查Excel工作表中是否存在列 - check if a column exists in Excel sheet Excel VBA 检查工作表是否已经存在 - Excel VBA check if a sheet already exists
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM