What is Wrong with my Formula?!?

mthrasher16

New Member
Joined
May 23, 2024
Messages
3
Office Version
  1. 365
Hi All,

I'm trying to make a pretty simple spreadsheet that calculates the time an employee works. All of my formulas are working fine except the most important one - this formula needs to be able to calculate the number of hours worked, regardless of weather or not time is put into the Lunch Start or Lunch End cells. (I have to do it this way to be able to tell how much time lapses between an employee punching in and their official start time. Otherwise I'd just do a much simpler formula where I keyed the length of their break in)

I think I'm close but keep getting a, 'There's a problem with this formula' prompt or a 'Too many arguments prompt.' Am I just stuck with a parenthesis is the wrong place or is my formula fundamentally flawed?

C15 = Time In
D15 = Lunch Start
E15 = Lunch End
F=15 = Time Out

This is my formula: =IFERROR(IF(COUNT(C16:F16=4),IF(F16<C16,1,(F16-E16)+(D16-C16)),IF(AND(LEN(C16)<>0),LEN(F16)<>0),IF(F16<C16,1,0+(F16-C16,0))*24,0

Thanks for your help!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Welcome to the forum! Does you day extend into the next day?
 
Upvote 0
Maybe try this:
(if this is not what you want, please provide some examples)
Book1
CDEFG
14Time InLunch StartLunch EndTime Out
1508:00:0012:00:0012:30:0016:30:0008:00:00
1608:00:0016:30:0008:30:00
1708:00:0012:30:0016:30:0008:30:00
1808:00:0012:00:0016:30:0008:30:00
Sheet1
Cell Formulas
RangeFormula
G15:G18G15=IF(OR(D15="",E15=""),F15-C15,(F15-E15)+(D15-C15))
 
Upvote 0
Maybe try this:
(if this is not what you want, please provide some examples)
Book1
CDEFG
14Time InLunch StartLunch EndTime Out
1508:00:0012:00:0012:30:0016:30:0008:00:00
1608:00:0016:30:0008:30:00
1708:00:0012:30:0016:30:0008:30:00
1808:00:0012:00:0016:30:0008:30:00
Sheet1
Cell Formulas
RangeFormula
G15:G18G15=IF(OR(D15="",E15=""),F15-C15,(F15-E15)+(D15-C15))

Dude - that seems to work! I had to add a "*24" to the end of your formula so the 'hours worked' formatting would work, but I think you got it!

I was making it way more complicated than it needed to be - as usual. : /

Thank you so much for your help!
 
Upvote 0

Forum statistics

Threads
1,217,383
Messages
6,136,264
Members
450,001
Latest member
KWeekley08

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