0

I have a SharePoint list that I'm using to track employee sick time. The "Actual Arrival/Departure Time" field is meant to display the actual time that the employee arrived/departed if they weren't out for the entire day.

What I'm trying to do is hide this field and set it to 'N/A' if the "Leave Type" field is set to 'Early Departure (unscheduled)' or 'Tardy (unscheduled)'

The formula I have in here currently is:

=IF([Leave Type]=OR("Early Departure (unscheduled)","Tardy (unscheduled)"),TEXT([Arrival/Departure Time],"hh:mm AM/PM"), "N/A")

and it is a "single line of text" field.

However, the results I get when I use the early departure or tardy option is a #NAME? error and when I use anything else I get a #VALUE! error.

Does anyone know how I can accomplish what I'm trying to do?

Joe Cambareri
  • 115
  • 2
  • 13

1 Answers1

2

We can use the formula below to achieve it.

=IF(OR([Leave Type]="Early Departure (unscheduled)",[Leave Type]="Tardy (unscheduled)"),"N/A",TEXT([Arrival/Departure Time],"hh:mm AM/PM"))

enter image description here

LZ_MSFT
  • 4,079
  • 1
  • 8
  • 9
  • Ugh, thank you so much! What about the part of the question where I'm looking for a script that will hide this field unless Leave Type is equal to Tardy or Early Departure? – Joe Cambareri Jan 17 '20 at 03:54
  • Use the formula: =IF(OR([Leave Type]="Early Departure",[Leave Type]="Tardy"),TEXT([Arrival/Departure Time],"hh:mm AM/PM"),"N/A") – LZ_MSFT Jan 17 '20 at 04:41
  • If you use modern list, we can also use column formatting to achieve it.https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting – LZ_MSFT Jan 17 '20 at 04:42