# Calculated Column - Choice Field

I'm just going to try and see if this is possible.

I have a Choice Column that has three scheduled work shifts for employees to choose from. My supervisor wants the time selections to schedule that amount of time on the calendar once submitted.

I'm not sure if a calculated field could work like this:

If "Work Shift"=[Midnight - 8 am] then "Scheduled Date"=[12 am - 8 am]

If "Work Shift"=[8 am - 4 pm] then "Scheduled Date"=[8 am - 4 pm]

If "Work Shift"=[4 pm - Midnight] then "Scheduled Date"=[4 pm - Midnight]

Sorry, I've never worked with calculated fields before.

Is this a possibility?

• Adding to this... I guess in order to block off an interval of time, you would need a "Scheduled Date Start" and a "Scheduled Date End". – cbbrown Dec 27 '16 at 21:36
• I haven't tried this but I think it is possible. You can use IF statement in the calculated column. Something like this: wendy-neal.com/2014/10/fun-sharepoint-calculated-columns – SharePointer Dec 28 '16 at 0:34

Below should work.

``````=IF( [WorkShift]="[Midnight - 8 am]"
;"12 am - 8 am"
; IF( [WorkShift]="[8 am - 4 pm]"
;"8 am - 4 pm"
;"4 pm - Midnight"
)
)
``````

To Explain above formula, understand this simple one given on MSDN

=IF([Column1]<=[Column2], "OK", "Not OK")

Suppose Column1 = 15000 and Column2 = 9000, above will store value as "Not Ok"

Now to check with some other value, you can use 3rd Parameter as Else If condition or Else Condition. which we did in your requirement.

``````If "Work Shift"=[Midnight - 8 am] then "Scheduled Date"=[12 am - 8 am]

Else If "Work Shift"=[8 am - 4 pm] then "Scheduled Date"=[8 am - 4 pm]

Else "Scheduled Date"=[4 pm - Midnight]
``````
• Note that ; is the non-english separator. All Functions and syntax that do work in Formulas is at: viewmaster365.com/365coach/#/Calculated_Column_Functions_List – Danny '365CSI' Engelman Dec 28 '16 at 7:45
• Can someone tell me what is wrong with this formula? I am trying to create individual shift start and end times to use for the time intervals in the calendar. =if([Work Shifts]=[Midnight - 8 am]; then [Start Time]==="12 am"); – cbbrown Dec 28 '16 at 21:27
• Format of formula should be =IF([Column1]<=[Column2], "OK", "Not OK") – Siddharth Vaghasia Dec 29 '16 at 3:10