cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheSlawekG
Level: Powered On

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 Team
Community Support Team

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
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 Team
Community Support Team

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

TheSlawekG
Level: Powered On

Re: Display 0 if one value is empty

Thank you!

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

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