将价值与另一个工作簿进行比较,并与2个规则进行比较

发布于 2025-01-30 09:53:06 字数 1125 浏览 2 评论 0原文

我一直在尝试使用VBA检查情况,但现在我正在挣扎 这是我在做什么的说明

  1. ,如果有任何“取消选中”条件(a)列

  2. ,那么目标是 data2和data4之间的比较(该本身的数据本身取消选中条件) data2和data2在另一个工作簿(Photo2)(不是另一个工作表)

  3. 要将其与另一个工作簿(Photo2)进行比较,我需要比较 data2(c)中的值(photo1) data中是否存在2在另一个工作簿(Photo2)中,我们得出的结论是,不作为f列中的最终结果

    例如,您可以看到A5& Photo2中的A7通过第一条规则,因为它们具有与C5&amp相同的值C7

  4. 这是困难的部分,当它通过3时。 但是规则是值不需要完全相同。但是,如果如果另一个工作簿中的data4值(photo2) 不超过50,则与相比最终结果

    ,例如,您可以从3中看到。)A5& A7通过规则,但在4中。 A5具有220次通过,因为差异为20,与200相比 范围150-250(200+-50)

photo1

”

photo2

“

是否有任何公式/vlookup/vba或其他运行的公式?

I have been trying to check the condition using VBA, but now I am struggling
here is the explanation of what I am doing

  1. if there's any 'uncheck' on condition(A) column

  2. then, The objective is comparison between data2 and data4 (which is the data of that itself uncheck condition) with data2 and data4 in another workbook (photo2) (not another worksheet)

  3. To compare it to another workbook (photo2), I need to compare whether the value in data2(C) column in (photo1) exists in data 2 in another workbook (photo2) if not we conclude that not pass as a final result in F column

    for example, as you can see A5 & A7 in photo2 pass 1st rule because they have the same value as C5 & C7

  4. here is the difficult part, when it pass 3.) rule, then I need to compare data4(E) column in (photo1) to data4 in another workbook (photo2)
    But the rule is the value does not need to be exactly the same. however if the data4 value in another workbook (photo2) isn't more/less than 50 compare to the value in data4 in photo1 then we conclude that pass as a final result

    for example, as you can see from 3.) A5 & A7 pass rule but in 4.) only
    A5 with 220 pass because the difference is 20 compare to 200 which in
    range 150-250 (200+-50)

photo1

photo 1

photo2

photo2

Is there any formula/vlookup/vba or whatever to run it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘿哥们儿 2025-02-06 09:53:06

如果您的工作表中有以下数据

工作表photo1

工作表photo2

您可以在result中使用此公式在f列中

=IF(A2="uncheck",IF(NOT(ISERROR(MATCH(C2,Photo2!A:A,0))),IF(ABS(INDEX(Photo2!B:B,MATCH(C2,Photo2!A:A,0))-E2)<=50,"pass","not pass"),"not pass"),"not pass")

说明该公式

=IF(A2="uncheck",
    IF(NOT(ISERROR(MATCH(C2,Photo2!A:A,0))),
        IF(ABS(INDEX(Photo2!B:B,MATCH(C2,Photo2!A:A,0))-E2)<=50,"pass","not pass"),
    "not pass"),
"not pass")

该部分if(iSERROR(iserror(c2,photo2!a:a code>)) ,0))))检查data2是否存在photo2如果没有匹配并返回错误(如果没有错误<代码) >不(IsError 它将检查以下内容:

IF(ABS(INDEX(Photo2!B:B,MATCH(C2,Photo2!A:A,0))-Photo1!E2)

where index(photo2!b:b,match(c2,photo2!a:a,0))将拉动data4来自photo2的值,与data2photo1data2Photo2匹配带有匹配(C2,Photo2!a:a,0)。 > ABS ,并测试这是&lt; = 50

if you have the following data in your worksheets

Worksheet Photo1
enter image description here

Worksheet Photo2
enter image description here

you can use this formula in result in column F

=IF(A2="uncheck",IF(NOT(ISERROR(MATCH(C2,Photo2!A:A,0))),IF(ABS(INDEX(Photo2!B:B,MATCH(C2,Photo2!A:A,0))-E2)<=50,"pass","not pass"),"not pass"),"not pass")

Explanation what the formula does

=IF(A2="uncheck",
    IF(NOT(ISERROR(MATCH(C2,Photo2!A:A,0))),
        IF(ABS(INDEX(Photo2!B:B,MATCH(C2,Photo2!A:A,0))-E2)<=50,"pass","not pass"),
    "not pass"),
"not pass")

This part IF(NOT(ISERROR(MATCH(C2,Photo2!A:A,0))) checks if data2 exists in Photo2 if not it does not match and returns an error (not pass) if there is no error NOT(ISERROR it will check the following:

IF(ABS(INDEX(Photo2!B:B,MATCH(C2,Photo2!A:A,0))-Photo1!E2)

Where INDEX(Photo2!B:B,MATCH(C2,Photo2!A:A,0)) will pull the data4 value from Photo2 by matching the data2 from Photo1 with the data2 from the Photo2 with MATCH(C2,Photo2!A:A,0). Then subtract data4 from Photo1 get the absolute value ABS of it and test if this is <=50. Then it is pass otherwise not.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文