Forum Discussion
JDEMARIE
Dec 30, 2018Copper Contributor
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 empl...
Haytham Amairah
Dec 31, 2018Silver Contributor
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