cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Display 0 if one value is empty

Hi,

 

I have an SP list as below:hours.PNG

 

My current formula for the column "Hours per Shift" is =TEXT([Time Out]-[Time In],"h"); it is being calculated fine when I have two dates. How I could display 0 if the "Time Out" column is empty so the calculation would be done only if two columns have a date in them?

 

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Display 0 if one value is empty

 

Hi @TheSlawekG ,

 

Please try this formula:

=IF([Time Out]="","0",TEXT([Time Out]-[Time In],"h"))

75.PNG

For more details on Calculated Field Formulas, please check this online doc:

https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/bb862071(v=offic...

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Display 0 if one value is empty

Just use an if statement looking to see if whichever column you choose is blank '0' otherwise put your calculation.

Highlighted
Community Support
Community Support

Re: Display 0 if one value is empty

 

Hi @TheSlawekG ,

 

Please try this formula:

=IF([Time Out]="","0",TEXT([Time Out]-[Time In],"h"))

75.PNG

For more details on Calculated Field Formulas, please check this online doc:

https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/bb862071(v=offic...

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper I
Helper I

Re: Display 0 if one value is empty

Thank you!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (4,543)