How to sum up working hours (a different schedule)

KarolinaKaralaite

New Member
Joined
Aug 29, 2024
Messages
6
Office Version
  1. 2021
Platform
  1. Windows
Hello,

I'm kinda new to excel and there is soooo many thingies in here... I've been spending days to figure out the problems in my formulas on my own but I got really stuck now...

So at first I was really happy that I was able to find formula and make it work for two rows of my employees (A and B). The formula I used was:

=SUM(IF(ISBLANK(B3:AF3),"",(MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24)))

But my employee "C" (5th row) has holidays for 10 days and I write them down as a letter "H" (stands for holiday). So I tried numerous formulas instead of ISBLANK like IFERROR or ISNUMBER but i still get #VALUE! or a 0:00. I even added additional letters like "P" (that stands for off day.). I thought if I remove all blank cells and make it only letters (cells with text in other words) I could make a certain formula to count hours. So to say I want a formula that it would ignore text but if its a number - that it would count hours.

My latest formula for this at AG5 for employee C was:
=SUM(IF(ISNUMBER(B5:AF5), MOD((RIGHT(B5:AF5,5)-LEFT(B5:AF5,5)),1)*24, 0))

But of course it gives me 0:00 value.

This timetable is for nurses that work in hospital 24h shifts, day shifts (11 hours), night shifts (13 hours) and additional hours if needed.

Can somebody help me to figure this formula out?
 

Attachments

  • excel.png
    excel.png
    45.9 KB · Views: 11

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Forgot to mention that this is whole October month I try to calculate hours for. Also I will try to upload mini-sheet.

Spalio darbo grafikas Bandymas slaugytojos.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAG
112345678910111213141516171819202122232425262728293031Total work hours
2Darbuotojai
3A08:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-14:48174.8
4B08:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-24:0000:00-08:0008:00-19:0019:00-24:0000:00-08:0008:00-14:4808:00-24:0000:00-08:00174.8
5CPP08:00-24:0000:00-08:00PP08:00-24:0000:00-08:00PP19:00-24:0000:00-08:00PHHHHHPPHHHHHPP08:00-24:0000:00-08:00P08:00-17:480:00
Sheet1
Cell Formulas
RangeFormula
AG3:AG4AG3=SUM(IF(ISBLANK(B3:AF3),"",(MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24)))
AG5AG5=SUM(IF(ISNUMBER(B5:AF5), MOD((RIGHT(B5:AF5,5)-LEFT(B5:AF5,5)),1)*24, 0))
 
Upvote 0
Hi,

going back to your original formula, you could use the OR() statement as your first check, as such perhaps ?

Excel Formula:
=SUM(IF(OR(ISBLANK(B3:AF3),B3:AF3="H",B3:AF3="P"),"",(MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24)))
 
Upvote 0
Hi,

going back to your original formula, you could use the OR() statement as your first check, as such perhaps ?

Excel Formula:
=SUM(IF(OR(ISBLANK(B3:AF3),B3:AF3="H",B3:AF3="P"),"",(MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24)))
I tried your formula but it shows again #VALUE! :(
Checked several times if I wrote it correctly
 
Upvote 0
maybe this one :

Excel Formula:
=SUM(IFERROR(MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24,0))
 
Upvote 1
Solution
THANK YOU OMG IT WORKED. I WAS TRYING TO FIGURE THIS OUT FOR 3 DAYS haha... I'm almost crying.

Thank you and big loves from me!
 
Upvote 0
your welcome, thanks for the feedback.

you had done the hard work in working out how to get your hours. then just break your formula down to see what its actually doing at each stage as such :

Book1
BCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
9168#VALUE!#VALUE!168#VALUE!######168#VALUE!#VALUE!168#VALUE!#VALUE!168#VALUE!#VALUE!168#VALUE!#VALUE!168#VALUE!#VALUE!6.8#VALUE!#VALUE!
10168001680016800168001680016800168006.800
11174.8
12
Sheet1
Cell Formulas
RangeFormula
B9:AF9B9=MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24
B10:AF10B10=IFERROR(MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24,0)
B11B11=SUM(IFERROR(MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24,0))
Dynamic array formulas.


Rob
 
Upvote 1
your welcome, thanks for the feedback.

you had done the hard work in working out how to get your hours. then just break your formula down to see what its actually doing at each stage as such :

Book1
BCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
9168#VALUE!#VALUE!168#VALUE!######168#VALUE!#VALUE!168#VALUE!#VALUE!168#VALUE!#VALUE!168#VALUE!#VALUE!168#VALUE!#VALUE!6.8#VALUE!#VALUE!
10168001680016800168001680016800168006.800
11174.8
12
Sheet1
Cell Formulas
RangeFormula
B9:AF9B9=MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24
B10:AF10B10=IFERROR(MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24,0)
B11B11=SUM(IFERROR(MOD((RIGHT(B3:AF3,5)-LEFT(B3:AF3,5)),1)*24,0))
Dynamic array formulas.


Rob
thank you for recomendation I will use this formula"dividing" tip in the future problems! :)
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

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