Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 217451

Help on making a new column with a condition

$
0
0

Hello everyone,

 

I couldn't find a way to do this:

I have a table with 2 columns. The first column are some codes, which CAN be repeated. The 2nd column is a binary unmber (0/1).

 

Example:

CODES   NUMBER

codeA   1

codeA   1

codeA   0

codeA   0

codeB   1

codeC   0

codeC   0

 

I need to make a 3rd column, with this logic: "If (at least one of the NUMBERs of a code is 1, then1, else 0)". So in the 3rd column, all the registers of codeA would be 1 because there are 2 of the NUMBERs of codeA that is 1. So the result would be:

 

CODES   NUMBER  3rdColumn

codeA   1   1

codeA   1   1

codeA   0   1

codeA   0   1

codeB   1   1

codeC   0   0

codeC   0   0

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 217451

Trending Articles