比较两列,如果匹配,则应在另一列中突出显示

时间:2019-05-23 12:09:11

标签: excel vba conditional-formatting

我有两列J和L。
如果J列的值与L列的对应值匹配,则两个单元格都应突出显示为红色。

我是这个Excel的新手。我无法开发此宏。

2 个答案:

答案 0 :(得分:4)

您可以使用条件格式来实现。创建新规则并添加

SAMPLES = ["SampleA", "SampleB"]

rule all:
    input:
        # Output of the final loop
        expand("loop3/{sample}.txt", sample = SAMPLES)

def looper_input(wildcards):
    # could be written more cleanly with a dictionary
    if (wildcards["prefix"] == "loop0"):
        input = "test/{}.txt".format(wildcards["sample"])
    else if (wildcards["prefix"] == "loop1"):
        input = "loop0/{}.txt".format(wildcards["sample"])
    ...
    return input


rule looper:
    input:
            looper_input
    output:
            "{prefix}/{sample}.txt"
    params:
            # ? should this be add="{prefix}" ?
            add=prefix
    shell:
            "awk '{{print $0, {params.add}}}' {input} > {output}"

在引用的两个单元格中,要比较的区域中的第一个。

enter image description here

然后在“应用于”框中,选择包含数据集的所有列=$J1=$L1 J

enter image description here

答案 1 :(得分:0)

您可以使用VBA进行尝试:

select t1.*
from table1 t1
where not exists (select 1 from table2 where t2.id = t1.id);

结果:

enter image description here