I want to count the amount of equal values between two distinct sets.
For example, the first set is composed of 15 distinct values, as figure below shows:
Next, I have another set, for example, line 1 in the next figure (set 1621), with another 15 distinct values. The problem is that I want to calculate the amount of values that are equal in both sets.
The problem is very similar to checking the result of a lottery ticket.
There are several "sets" to compare to the initial set (for example, in the figure above we have sets 1621, 1620, and so on). Each set appears in a next row in the spreadsheet.
However, the expected presentation is as follows: the amount of equal values between each comparison should be presented in distinct columns, as figure below shows:
If we used a formula, in R2, S2, T2 like
=SUMPRODUCT(COUNTIF($B$2:$P$2;Sheet2!B1:P1))
=SUMPRODUCT(COUNTIF($B$2:$P$2;Sheet2!B2:P2))
=SUMPRODUCT(COUNTIF($B$2:$P$2;Sheet2!B3:P3))
It could work fine, and the results would show up. However, instead of manually typing such functions into each individual cell, as this would be very time-consuming, I would like to have a solution to increment the rows across columns.
Put this in the first cell and copy accross:
=SUMPRODUCT(COUNTIF(INDEX(Sheet2!$B:$P,COLUMN(A:A),0);$B$2:$P$2))
As it is dragged accross the COLUMN(A:A) will iterate and first return 1 then 2 then 3 the ... indicating the row to return.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.