Sum time over night

Simbor2

New Member
Joined
Apr 14, 2023
Messages
11
Platform
  1. Windows
Hi,
My shedule for my workers have worked so far but now there is a shift ending after midnight and I don't know how to fix it.
This is how it looks now. A formula to take a 30 min lunch away. The formula is in Swedish, but maybe still better to understand than a picture.

Timanställda schema 2023.xlsx
BCDEF
520:00
5313:0022:008:30Oskar
5413:0022:008:30Mohammed
5516:0001:00#########Amged
5616:0001:00#########Jesca
5716:0001:00#########Ali A
5816:0001:00#########Maya
590:00
Vecka 23
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F47:F58Cellcontains a blank value textNO
F59Cellcontains a blank value textNO
D36:D45,D61:D70,D72:D81,D14:D23,D3:D12,D25:D34,D47:D59Cell Value=0textNO
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
how about
=(MOD(B2-A2,1)*24)-0.5
Book7
ABCDE
10
213:00:0022:00:0008.5Oskar
313:00:0022:00:0008.5Mohammed
416:00:0001:00:0008.5Amged
516:00:0001:00:0008.5Jesca
616:00:0001:00:0008.5Ali A
716:00:0001:00:0008.5Maya
80
Sheet1
Cell Formulas
RangeFormula
D2:D7D2=(MOD(B2-A2,1)*24)-0.5
C1:C8C1=IF(C52-B52>4/24,C52-B52-0.5/24,C52-B52)
 
Upvote 0
how about
=(MOD(B2-A2,1)*24)-0.5
Book7
ABCDE
10
213:00:0022:00:0008.5Oskar
313:00:0022:00:0008.5Mohammed
416:00:0001:00:0008.5Amged
516:00:0001:00:0008.5Jesca
616:00:0001:00:0008.5Ali A
716:00:0001:00:0008.5Maya
80
Sheet1
Cell Formulas
RangeFormula
D2:D7D2=(MOD(B2-A2,1)*24)-0.5
C1:C8C1=IF(C52-B52>4/24,C52-B52-0.5/24,C52-B52)

I'll try it out! Thanks!
 
Upvote 0
how about

(REST = MOD in swedish)
This is the result. Don't understand it.

Timanställda schema 2023.xlsx
BCDEF
5313:0022:008:30Oskar
5413:0022:008:30Mohammed
5516:0001:00204:00Amged
5616:0001:00########Jesca
5716:0001:00########Ali A
5816:0001:00########Maya
Vecka 23
Cell Formulas
RangeFormula
D53:D54,D56:D58D53=IF(C53-B53>4/24,C53-B53-0.5/24,C53-B53)
D55D55=(MOD(C55-B55,1)*24)-0.5
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F47:F58Cellcontains a blank value textNO
D36:D45,D61:D70,D72:D81,D14:D23,D3:D12,D25:D34,D47:D59Cell Value=0textNO
Cells with Data Validation
CellAllowCriteria
B53:C58Timebetween 00:00:00 and 23:59:00
F53:F58List=$K$85:$K$105
 
Upvote 0
the cell is formatted as TIME
change the format to general for all cells in column D

Notice I get a decimal point
you get a colon

the result is just a number , not a time
 
Upvote 0
the cell is formatted as TIME
change the format to general for all cells in column D

Notice I get a decimal point
you get a colon

the result is just a number , not a time
Is it possible to keep it as time?
Add a calculation to the whole formula?
 
Upvote 0
=((MOD(B2-A2,1)*24)-0.5)/24

Book10
ABCDE
10
20.5416666670.916666667008:30:00Oskar
30.5416666670.916666667008:30:00Mohammed
40.6666666670.041666667008:30:00Amged
50.6666666670.041666667008:30:00Jesca
60.6666666670.041666667008:30:00Ali A
70.6666666670.041666667008:30:00Maya
80
Sheet1
Cell Formulas
RangeFormula
D2:D7D2=((MOD(B2-A2,1)*24)-0.5)/24
C1:C8C1=IF(C52-B52>4/24,C52-B52-0.5/24,C52-B52)
 
Upvote 0
=((MOD(B2-A2,1)*24)-0.5)/24

Book10
ABCDE
10
20.5416666670.916666667008:30:00Oskar
30.5416666670.916666667008:30:00Mohammed
40.6666666670.041666667008:30:00Amged
50.6666666670.041666667008:30:00Jesca
60.6666666670.041666667008:30:00Ali A
70.6666666670.041666667008:30:00Maya
80
Sheet1
Cell Formulas
RangeFormula
D2:D7D2=((MOD(B2-A2,1)*24)-0.5)/24
C1:C8C1=IF(C52-B52>4/24,C52-B52-0.5/24,C52-B52)


Timanställda schema 2023.xlsx
BCDEF
5516:0001:0014:30Amged
Vecka 23
Cell Formulas
RangeFormula
D55D55=((MOD(B55-C55,1)*24)-0.5)/24
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F47:F58Cellcontains a blank value textNO
D36:D45,D61:D70,D72:D81,D14:D23,D3:D12,D25:D34,D47:D59Cell Value=0textNO
Cells with Data Validation
CellAllowCriteria
B55:C55Timebetween 00:00:00 and 23:59:00


Should be 8:30
 
Upvote 0
yep, mine is

change to general and see the decimal number

Book1
ABCDE
10
20.5416666670.91666666700.354166667Oskar
30.5416666670.91666666700.354166667Mohammed
40.6666666670.04166666700.354166667Amged
50.6666666670.04166666700.354166667Jesca
60.6666666670.04166666700.354166667Ali A
70.6666666670.04166666700.354166667Maya
Sheet1
Cell Formulas
RangeFormula
C1:C7C1=IF(C52-B52>4/24,C52-B52-0.5/24,C52-B52)
D2:D7D2=((MOD(B2-A2,1)*24)-0.5)/24


perhaps its a change in countries - not sure why

perhaps put the sample spreadsheet onto a share..

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 0
Hello. Try with:

Libro1
BCDEF
5313:0016:003:00Oskar
Hoja1
Cell Formulas
RangeFormula
D53D53= (B53>C53)+C53-B53 - (6*((B53>C53)+C53-B53)>1)/48
 
Upvote 0

Forum statistics

Threads
1,215,374
Messages
6,124,566
Members
449,171
Latest member
jominadeo

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