[英]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.