cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Yngeinstn
Level IV

Assign a "bin" value based on odd or even value in another column

Is it possible to assign a "bin" value based on the number being odd or even.  The attached table already has a bin column but i am trying to split this pick list up and making every other part a different bin

 

Thanks

 

Even = 1

Odd = 2

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Assign a "bin" value based on odd or even value in another column

Assuming that column SeqNo is the column you want to have the odd and even binning based on the formula for the bin_2 is:

mod( :SeqNo, 2 ) +1;

Mod, or Modulo returns the remainder from dividing the first value by the second value.

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Assign a "bin" value based on odd or even value in another column

Assuming that column SeqNo is the column you want to have the odd and even binning based on the formula for the bin_2 is:

mod( :SeqNo, 2 ) +1;

Mod, or Modulo returns the remainder from dividing the first value by the second value.

Jim
dale_lehman
Level VII

Re: Assign a "bin" value based on odd or even value in another column

txnelson beat me to it!  Anyway, I attached my version of his solution using the mod function, assuming you wanted to do this by row number.  Of course, you could use any other numeric value to spit by odd/even this way.