 • 466K Members
• 8,614 Online
• 563K Conversations

# How to return a 0 in a blank cell-formula

Hello all,

I have a formula below where I am returning the number of hours (i.e. 12) depending on what's typed in the B column. My question is, if a cell in the B column is blank because the employee is off that day, how do I add to the formula below so it returns a 0 (zero) if the cell is blank?

=IFS(\$B\$4:\$B\$16="7A-7:30P","12","7P-7:30A","12","8A-4:30P","8","1P-7:30P","6","7P-3:30A","8")

2 Replies

# Re: How to return a 0 in a blank cell-formula

Hi,

This formula seems to be incorrect and return the wrong result.

So, I've rebuilt this formula for you to return the correct result and to take into account if the blank cells.

`=IFS(OR(B4="7A-7:30P",B4="7P-7:30A"),12,OR(B4="8A-4:30P",B4="7P-3:30A"),8,B4="1P-7:30P",6,B4="",0)`

Also, you can use the SWITCH function as follows which is shorter:

`=SWITCH(B4,"7A-7:30P",12,"7P-7:30A",12,"8A-4:30P",8,"7P-3:30A",8,"1P-7:30P",6,0)` Hope that helps

# Re: How to return a 0 in a blank cell-formula

If don't use predefined shift, however assume they have the same logic in names, that could be

`=IFERROR(((MID(B3,SEARCH("-",B3)+1,LEN(B3)-SEARCH("-",B3)-1)&":00")+(MID(B3,SEARCH("-",B3)-1,1)<>RIGHT(B3,1))*0.5-(LEFT(B3,SEARCH("-",B3)-2) &":00"))*24-0.5,0)`

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies