Trying to group column into 1, 3, 5, 7 and 7+ using ifelse

I am trying to group column data into different bands (1, 3, 5, 7, 7+).

Currently using the below (Tested it on 1, 3, 5 and NULL).

ifelse({days_waiting_to_be_processed}=1, 1, ifelse({days_waiting_to_be_processed}>1 OR {days_waiting_to_be_processed}=3, 3, ifelse({days_waiting_to_be_processed}>3 OR {days_waiting_to_be_processed}=5, 5, NULL)))

It only returns 1 and 3, I am unsure where I am going wrong.

Thanks Tom

days_waiting_to_be_processed > 1 will come back true first in your if else.

I think you just need to reorder your ifelse.

ifelse({days_waiting_to_be_processed}=1, 1, ifelse({days_waiting_to_be_processed}>3 OR {days_waiting_to_be_processed}=5, 5, ifelse({days_waiting_to_be_processed}>1 OR {days_waiting_to_be_processed}=3, 3, NULL)))