excel - compare 3 ranges instead of 2 -


public function compare(r1 range, r2 range) long    dim r range, v variant, v2 variant    dim rr range    each r in r1       v = r.value       if v <> 0 , v <> ""          each rr in r2             v2 = rr.value             if v = v2 compare = compare + 1          next rr       end if    next r end function 

this udf compares 2 ranges , return number of matched values. compare 3 ranges instead, in order find how many values appeared in 3 ranges simultaneously.

much appreciate help.

public function compare(r1 range, r2 range, r3 range) long    dim r range, v variant, m1 variant, m2 variant    dim rv long     rv = 0    each r in r1       v = r.value       if v <> 0 , v <> "" , not iserror(v)             m1 = application.match(v, r2, 0)             m2 = application.match(v, r3, 0)             if not iserror(m1) , not iserror(m2)                rv = rv + 1             end if       end if    next r    compare = rv end function 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -