Search code examples
google-sheets

Calculating derived values


I am trying to work out how to write an intuitive formula in google-sheets that, given two tables (of booleans) with dimensions AxB, CxB, one generates the correlating table CxA following boolean OR.

What formula can be used to generate the table CxA? I definitely want the table to be filled using a single cell formula.

I have been thinking of using map, byrow, bycol or scan, but each time I start out I get lost in the matrix.

The tables below highlight the case where R is true for [a,e]; [1,2,3,6] are true for a; and [3,4,6] are true for e:- therefore [1,2,3,4,6] are true for R.

AxB R B G K
a 1 0 0 0
b 0 0 0 1
c 0 1 1 0
d 0 1 0 0
e 1 1 0 0
CxB 1 2 3 4 5 6
a 1 1 1 0 0 1
b 0 0 1 0 1 0
c 0 1 0 1 1 0
d 1 1 0 1 1 0
e 0 0 1 1 0 1
CxA 1 2 3 4 5 6
R 1 1 1 1 0 1
B 1 1 1 1 1 1
G 0 1 0 1 1 0
K 0 0 1 0 1 0

Solution

  • You may try:

    =index(sign(mmult(transpose(C3:F7),K3:P7)))
    

    enter image description here