简体   繁体   English

检查两个其他工作表中是否存在单元格值

[英]checking if cell value exists in two other sheets

I am trying to track IDs within several different sheets and I want to be able to give a True value for one criteria and false for another. 我试图在几个不同的工作表中跟踪ID,我希望能够为一个标准提供True值,为另一个标准提供false。 Here is my pseudo code for what I am trying to accomplish. 这是我想要完成的伪代码。

IF sheet1.A1.value EXISTS AND DOES NOT EXIST IN sheet2.A:A OR sheet3.A:A
THEN RETURN "true"
ELSE RETURN "false"

Try this 尝试这个

Sub Sample()
    Dim SearchString As String

    SearchString = "Blah"

    If Application.WorksheetFunction.CountIf(Sheets("Sheet1").Columns(1), SearchString) > 0 And _
    Application.WorksheetFunction.CountIf(Sheets("Sheet2").Columns(1), SearchString) = 0 And _
    Application.WorksheetFunction.CountIf(Sheets("Sheet3").Columns(1), SearchString) = 0 Then
        '~~> Display relevant message
    Else
        '~~> Display relevant message
    End If
End Sub

You could also do this with just an excel formula like this: 你也可以用这样的excel公式来做到这一点:

=IF(AND(len('Sheet1'!A1)>0 , ISERROR(MATCH('Sheet1'!A1,'Sheet2'!A:A,0)), ISERROR(MATCH('Sheet1'!A1,'Sheet3'!A:A,0))) , "True", "False")

This Reads: 本读:

  • If the following three condiitons are met, then True, otherwise False 如果满足以下三个条件,则为True,否则为False
  • Condition 1: Sheet1's Cell A1 exists 条件1:Sheet1的Cell A1存在
    • Check if the length of any value in it is greater than 0 检查其中任何值的长度是否大于0
  • Condition 2: Sheet1's Cell A1 not in Sheet 2's column A 条件2:Sheet1的单元格A1不在表2的A列中
    • Run a match formula to check this 运行匹配公式来检查这一点
    • If the match returns an error, then it was not found 如果匹配返回错误,则找不到它
  • Condition 3 条件3
    • Run a match formula to check this 运行匹配公式来检查这一点
    • If the match returns an error, then it was not found 如果匹配返回错误,则找不到它

暂无
暂无

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

相关问题 检查同一工作簿中另外两张工作表中的一个单元格和两列并显示两个输出 - Checking one cell against two columns in two other sheets in the same workbook and showing two outputs 检查其他多个工作表上是否存在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 检查另一个单元格中是否存在一个单元格值 - Checking if a cell value exists in another cell 如果其他列的单元格中的值与其他工作表中的值匹配,则链接不同工作表中一列的两个单元格 - Link two cells of a column in different sheets if a value in a cell of other column matches in other sheet 计算值是否存在于两个不同的工作表中 - Count if value exists in two different sheets 检查 excel 表中是否存在 Pandas DataFrame 系列中的值 - Checking if value in pandas DataFrame series exists in excel sheets 通过使用 python 检查值是否存在来查找 excel 单元格的 id - Lookup the id of an excel cell by checking if value exists using python 检查目标行以外的列中是否存在值 - Checking if value exists in column other than target row 如何根据单元格值将数据复制到其他工作表 - How do i copy data to other sheets based on cell value Excel VBA 按其他工作表上的单元格值过滤并使用公式 - Excel VBA filtering by cell value on other sheets and using formula
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM