Kako izračunati ure med urami po polnoči v Excelu?
Avtor: XiaoyangZadnja sprememba: 2020-05-08
Recimo, da imate časovni razpored za beleženje delovnega časa, je čas v stolpcu A začetek danes, čas v stolpcu B pa čas konca naslednjega dne. Če izračunate časovno razliko med obema časoma z neposrednim minusom "= B2-A2", običajno ne bo prikazal pravilnega rezultata, kot je prikazano na levi sliki zaslona. Kako bi lahko pravilno izračunali ure med dvakrat po polnoči v Excelu?
Če želite pravilno izračunani rezultat dobiti dvakrat čez polnoč, lahko uporabite naslednjo formulo:
1. Vnesite to formulo: =(B2-A2+(B2<A2))*24 (A2 je zgodnejši čas, B2 je poznejši čas, jih lahko po potrebi spremenite) v prazno celico, ki poleg vaših časovnih podatkov, si oglejte sliko zaslona:
2. Nato povlecite ročico za polnjenje do celic, v katere želite izpolniti to formulo, in časovne razlike med dvakrat po polnoči so bile izračunane hkrati, glejte posnetek zaslona:
This comment was minimized by the moderator on the site
Hi All,
So I have a list of employees, all their working dates with start and end time & date.
I need to figure out how many hours were spent after midnight- night hours. The issue is that there are all sort of starting and finish times- some of the shifts were day shift the others started at 9pm till 2am, others started 10pm till next morning 5 am, etc.
Is there a way of calculating this using a generic formula for all lines?
I have tried so many variations but excel does not want to collaborate!
This comment was minimized by the moderator on the site
Hello, Timea
If you just need to get the hours worked after midnight, the below formula may help you: =IF(DAYS(B2,A2)>0,(B2-A2+(B2<A2))*24,"")
Please try, hope it can help you!
This comment was minimized by the moderator on the site
Very clever, using the comparison (b2<a2) to return a boolean result so if it's after midnight it adds 1. It took me a minute to understand what you did it was so elegant.
This comment was minimized by the moderator on the site
Hi, i need help please. I have data that auto loads daily at 5pm. The process is broken into 2 parts (ETL1 and ETL2). ETL1 starts at 5pm till 11pm and ETL2 starts at 11 till 4 am. at 7 am i run a script to check if everything ran. each row has a start and end date time. i would like to flag all data after 5pm yesterday as todays data. Currently when i filter on today, i only see the rows where the date is after 00:00
This comment was minimized by the moderator on the site
No, Austin's correction works for me. The original with the parentheses where they are shown does not work. Maybe a diifferent version of Excel makes a difference? I am on MS Home and Office 2016