Compare and get a count of expression

Hello ,

I have two expression rules, rule 1 & rule 2. I want to compare them and print its count into grid.

RULE 1

ABC

CDE

GHI

JKL

RULE 2

ABC

DEF

ABC

DEF

GHI

ABC

I want to compare rule 1 with rule 2 and count of match records to show in grid. Like

count 

for ABC count should be 3 and so on.

  Discussion posts and replies are publicly visible