I have some data in columns, several binary variables:

```
| A | B | C |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |
| 1 | 1 | 0 |
```

and then another variable with three values:

```
| X |
| 1 |
| 0 |
|-1 |
| 1 |
| 0 |
| 1 |
```

What I want to do is to write a lookup per column A-C... that, when it finds a `1`

variable, adds the corresponding number from the same row in Column X to an ongoing count.

Now, the twist is that I want to maintain two different counts, one for all of the `1`

s in Column X that correspond to `1`

s in columns A-C... and another for all the `-1`

s that similarly correspond.

Is there a simple way to do this? I assume it involves `vlookup`

.

`positive`

and`negative`

counter, if that makes sense. – fox Apr 24 '13 at 2:44`positive`

would be 1 and`negative`

would be 0; in the case of C,`positive`

would be 1 and`negative`

would be 1. Both columns essentially work as a mask over X. – fox Apr 24 '13 at 4:54