如果Google表格中的VLOOKUP具有IF条件

时间:2019-10-04 18:12:08

标签: if-statement google-sheets google-sheets-formula array-formulas gs-vlookup

我想比较下面两张纸(将两张纸上所有可用的单元格进行比较)和vlookup。如果两张纸上都有一行,则答案应为“是!”,否则答案应为“否!”。

我在sheet1中有以下数据

        String fileName = "data.m3u";
        File storageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES)
                        + "/Netuptv");
        boolean success = true;
        if (!storageDir.exists()) {
            success = storageDir.mkdirs();
        }
        if (success) {
            File file = new File(storageDir,fileName);
            filepath = file.getAbsolutePath();
        }

另一张sheet2包含以下数据,

PONo        Code    UID
84914741980 VPP5P   14908660
84914741893 VPP5P   14908653
84914750226 XWKGY   14915367
84914740202 XWKGY   14907478
84914751843 R10KJ   14915997
84914750226 R10KJ   14915366
84914759442 CPC7G   14921768
84914750025 TN78Y   14913781

我希望答案像下面一样

PONo        Code    UID
84914741980 VPP5P   14908660
84914741893 VPP5P   14908653
84914750226 XWKGY   14915367
84914750025 TN78Y   14913781
84914750025 TN78Y   14913779
84914743001 TN78Y   14909949
84914740202 TN78Y   14907477
84914740202 TN78Y   14907476
84914741893 YH3T9   14908652

有帮助的论坛帮助完成此任务!

我尝试了以下公式,但部分起作用。

PONo        Code    UID         Answer
84914741980 VPP5P   14908660    Yes
84914741893 VPP5P   14908653    Yes
84914750226 XWKGY   14915367    Yes
84914740202 XWKGY   14907478    No
84914751843 R10KJ   14915997    No
84914750226 R10KJ   14915366    No
84914759442 CPC7G   14921768    No
84914750025 TN78Y   14913781    Yes

1 个答案:

答案 0 :(得分:0)

尝试这样:

=ARRAYFORMULA(IF(A2:A<>"", IF(IFERROR(VLOOKUP(A2:A&B2:B&C2:C, 
 Sheet2!E2:E&Sheet2!F2:F&Sheet2!G2:G, 1, 0))<>"", "yes", "no"), ))

log-based metric