Formula to show a zero when options is not there.

Robert Wyatt

Board Regular
Joined
Jul 15, 2012
Messages
108
Office Version
  1. 2019
Platform
  1. Windows
I'm trying to fix up a time sheet to show hours worked in corresponding cells I have included a XL2BB copy of what I'm working on and how I would like for it to work. can you tell me how to make it show zero when options show Off. once you look at the sample, I'm sure yo
Book3.xlsm
ABCDEFGHIJKL
1Overtime Options
2FALSE
3After:8Hrs
4
5TRUETRUE
6After:40Hrs
7
8
9
10
11
12
13
14
15
16
17WeekdayOptionsShift StartsLunch StartsLunch endsShift EndsTotal HrsRegular HrsOvertime HrsSick Holidayvacation
18
19Mon 12/30Regular8:00 AM11:30 AM12:00 PM4:30 PM8.008.00-FALSEFALSEFALSE
20Tue 12/31Regular8:00 AM11:30 AM12:00 PM4:30 PM8.008.00-FALSEFALSEFALSE
21Wed 01/01Holiday8:00 AM11:30 AM12:00 PM4:30 PMFALSE--FALSE8.00FALSE
22Thu 01/02Regular8:00 AM11:30 AM12:00 PM4:30 PM8.008.00-FALSEFALSEFALSE
23Fri 01/03Regular8:00 AM11:30 AM12:00 PM4:30 PM8.008.00-FALSEFALSEFALSE
24Sat 01/04OffFALSE--FALSEFALSEFALSE
25Sun 01/05OffFALSE--FALSEFALSEFALSE
26Total Hrs:32.00--8.00-
Sheet1
Cell Formulas
RangeFormula
H19:H25H19=G19-I19
I19:I25I19=ROUND(MAX(IF($K$5,MAX(0,SUM(H$18:H18)+G19-$K$6),0),IF($K$2,IF(G19>$K$3,G19-$K$3,0),0)),2)
J19:J25J19=IF(B19="Sick",MROUND((MOD(F19-C19,1)-MOD(E19-D19,1))*24,1/4))
K19:K25K19=IF(B19="Holiday",MROUND((MOD(F20-C20,1)-MOD(E20-D20,1))*24,1/4))
L19:L25L19=IF(B20="Vacation",MROUND((MOD(F20-C20,1)-MOD(E20-D20,1))*24,1/4))
H26:L26H26=SUM(H19:H25)
G19:G25G19=IF(B19="REGULAR",MROUND((MOD(F19-C19,1)-MOD(E19-D19,1))*24,1/4))
u'll see what I'm doing.
 
Try these formulas with the given range (I've left the overtime hours in Col. I as they reference another sheet)

G19:G25
Excel Formula:
=IF(B19="Off",0,MROUND((MOD(F19-C19,1)-MOD(E19-D19,1))*24,1/4))
H19:H25
Excel Formula:
=IF(B19="Regular",G19-I19,0)
J19:J25
Excel Formula:
=IF(B19="Off",0,IF(B19="Sick",G19,0))
K19:K25
Excel Formula:
=IF(B19="Off",0,IF(B19="Holiday",G19,0))
L19:L25
Excel Formula:
=IF(B19="Off",0,IF(B19="Vacation",G19,0))
this worked great thanks
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,225,371
Messages
6,184,581
Members
453,244
Latest member
Todd Luet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top