cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
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.

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Kudoed Authors (Last 30 Days)
Users online (4,571)