D
Del Cotter
For some reason I can't figure this one out. What's the most elegant way
to sum up a list of numbers according to a binary truth table? To start
with, here's an example of the raw data:
C B A Combo Numbers
N N N None 42
N N Y A only 23
N Y N B only 16
N Y Y A & B 26
Y N N C only 20
Y N Y A & C 11
Y Y N B & C 10
Y Y Y All 51
But now I want to add up all the rows in which, e.g. B has any part,
like so:
C B A Combo Numbers
N N Y A any 23+26+11+51=111
N Y N B any 16+26+10+51=103
N Y Y A & B 26+51=77
Y N N C any 20+11+10+51=92
Y N Y A & C 11+51=62
Y Y N B & C 10+51=61
Y Y Y All 51
I thought this would be easy, but I can't get my head around it. I'm
willing to change Y/N to binary TRUE/FALSE or 1/0 if it will make an
elegant function, but what function will best read the list above to
make the list below?
to sum up a list of numbers according to a binary truth table? To start
with, here's an example of the raw data:
C B A Combo Numbers
N N N None 42
N N Y A only 23
N Y N B only 16
N Y Y A & B 26
Y N N C only 20
Y N Y A & C 11
Y Y N B & C 10
Y Y Y All 51
But now I want to add up all the rows in which, e.g. B has any part,
like so:
C B A Combo Numbers
N N Y A any 23+26+11+51=111
N Y N B any 16+26+10+51=103
N Y Y A & B 26+51=77
Y N N C any 20+11+10+51=92
Y N Y A & C 11+51=62
Y Y N B & C 10+51=61
Y Y Y All 51
I thought this would be easy, but I can't get my head around it. I'm
willing to change Y/N to binary TRUE/FALSE or 1/0 if it will make an
elegant function, but what function will best read the list above to
make the list below?