cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Choose Language Hide Translation Bar
lizrdee
Level II

Breaking down time of day into shifts

Hello, 

 

I have time data that I would like to breakdown into shifts to analyze shift patterns 
9:00PM-5:59AM = night shift

6:00AM-11:59AM = morning shift

12:00PM-8:59PM = afternoon shift

 

 

Can anyone provide any guidance on how to do this with a formula or script? I'm a beginner and am just using recode which is very slow. 

Time column.JPG

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Breaking down time of day into shifts

You can copy this script and then paste it as the formula for the second column:

 

If(
	In Hours( 6 ) <= :CST < In Hours( 12 ), "Morning Shift",
	In Hours( 12 ) <= :CST < In Hours( 21 ), "Afternoon Shift",
	"Night Shift",
);

I can't test it but you can! 

View solution in original post

4 REPLIES 4

Re: Breaking down time of day into shifts

You can copy this script and then paste it as the formula for the second column:

 

If(
	In Hours( 6 ) <= :CST < In Hours( 12 ), "Morning Shift",
	In Hours( 12 ) <= :CST < In Hours( 21 ), "Afternoon Shift",
	"Night Shift",
);

I can't test it but you can! 

lizrdee
Level II

Re: Breaking down time of day into shifts

Thank you so much it worked! I was wondering how to format the formula so this was really helpful.

Jeff_Perkinson
Community Manager Community Manager

Re: Breaking down time of day into shifts

You might find value in Using dates, times, datetimes and durations in JMP

-Jeff

Re: Breaking down time of day into shifts

I amended my solution to use literal times instead of computing them.

 

If(
	06:00:00 <= :CST < 12:00:00, "Morning Shift",
	12:00:00 <= :CST < 21:00:00, "Afternoon Shift",
	"Night Shift",
);

I think that it improves the legibility and efficiency of this formula.