Preskoči na glavno vsebino

Kako izračunati ure med urami po polnoči v Excelu?

doc izračuna čas čez noč 1

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?

Izračunajte ure med dvakrat po polnoči s formulo


puščica modri desni mehurček Izračunajte ure med dvakrat po polnoči s formulo

Č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:

doc izračuna čas čez noč 2

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:

doc izračuna čas čez noč 3

Najboljša pisarniška orodja za produktivnost

🤖 Kutools AI Aide: Revolucionirajte analizo podatkov na podlagi: Inteligentna izvedba   |  Ustvari kodo  |  Ustvarite formule po meri  |  Analizirajte podatke in ustvarite grafikone  |  Prikličite funkcije Kutools...
Priljubljene funkcije: Poiščite, označite ali identificirajte dvojnike   |  Izbriši prazne vrstice   |  Združite stolpce ali celice brez izgube podatkov   |   Krog brez formule ...
Super iskanje: Več kriterijev VLookup    Multiple Value VLookup  |   VLookup na več listih   |   Nejasno iskanje ....
Napredni spustni seznam: Hitro ustvarite spustni seznam   |  Odvisni spustni seznam   |  Večkrat izberite spustni seznam ....
Upravitelj stolpcev: Dodajte določeno število stolpcev  |  Premakni stolpce  |  Preklop stanja vidnosti skritih stolpcev  |  Primerjaj obsege in stolpce ...
Predstavljene funkcije: Mrežni fokus   |  Pogled oblikovanja   |   Velika vrstica formule    Upravitelj delovnih zvezkov in listov   |  Knjižnica virov (Samodejno besedilo)   |  Izbirnik datuma   |  Združite delovne liste   |  Šifriranje/dešifriranje celic    Pošljite e-pošto po seznamu   |  Super filter   |   Poseben filter (filter krepko/ležeče/prečrtano ...) ...
15 najboljših kompletov orodij12 Besedilo Orodja (dodajanje besedila, Odstrani znake,...)   |   50 + Graf Vrste (Gantt Chart,...)   |   40+ Praktično Formule (Izračunajte starost glede na rojstni dan,...)   |   19 vstavljanje Orodja (Vstavite kodo QR, Vstavi sliko s poti,...)   |   12 Pretvorba Orodja (Številke v besede, Pretvorba valut,...)   |   7 Spoji in razdeli Orodja (Napredne kombinirane vrstice, Razdeljene celice,...)   |   ... in več

Napolnite svoje Excelove spretnosti s Kutools za Excel in izkusite učinkovitost kot še nikoli prej. Kutools za Excel ponuja več kot 300 naprednih funkcij za povečanje produktivnosti in prihranek časa.  Kliknite tukaj, če želite pridobiti funkcijo, ki jo najbolj potrebujete...

Opis


Kartica Office prinaša vmesnik z zavihki v Office in poenostavi vaše delo

  • Omogočite urejanje in branje z zavihki v Wordu, Excelu, PowerPointu, Publisher, Access, Visio in Project.
  • Odprite in ustvarite več dokumentov v novih zavihkih istega okna in ne v novih oknih.
  • Poveča vašo produktivnost za 50%in vsak dan zmanjša na stotine klikov miške za vas!
Comments (23)
No ratings yet. Be the first to rate!
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,
In fact, the formula in this article can solve your problem, see below screenshot:
https://www.extendoffice.com/images/stories/comments/comment-skyyang/2023-comment/doc-calculate-hours.png
Please have a try, thank you!
This comment was minimized by the moderator on the site
Thank you for your reply.

I only want to know the hours worked after midnight, so only the night hours.
Not total hours worked.
Hope this makes sense.
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
Hello,
You are welcome. Glad it helps. Any questions, please feel free to contact us. Have a great day.
Sincerely,
Mandy
This comment was minimized by the moderator on the site
This doesn't work with all data. The solution I tried after trying the above was =IF(B22>C22,(C22-0)+(24-B22),C22-B22)
This comment was minimized by the moderator on the site
=IF(B22>C22,(C22-0)+(24-B22),C22-B22) is perfect but instead of ( , ) use ( ; )
thankyouverymuch
This comment was minimized by the moderator on the site
Doesn't work for me... Formula incorrect.
This comment was minimized by the moderator on the site
Great solution, very useful! Thanks :)
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
Can someone explain when the function of addition of the TRUE/FALSE values does so I can understand the formula please?
This comment was minimized by the moderator on the site
True = 1, False = 0
This comment was minimized by the moderator on the site
I think a simple MOD(B2-A2,1) should be enough?
This comment was minimized by the moderator on the site
This is undoubtedly the best and shortest solution.
This comment was minimized by the moderator on the site
Austin, the formula stated in the article above works well for me
This comment was minimized by the moderator on the site
The formula under bullet point #1 is wrong. =(B2-A2+(B2<A2))*24, but is should read as =B2-A2+(B2<A2)*24.

The parentheses are in the wrong spot.
This comment was minimized by the moderator on the site
THANK YOU! This is definitely the correct formula.
This comment was minimized by the moderator on the site
Yes Austin! Your formula works, the other formula renders nonsense (in my case). Thanks!!
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
This comment was minimized by the moderator on the site
The original formula works better than your suggestion Austin.
I also used =(A2-B2+(A2<B2))*1440
This worked best to convert time into minutes.
This comment was minimized by the moderator on the site
Depois de colocar a formatação ao tentar somar a coluna total de horas o valor dá-me errado.

O campo é formatado [h]mm
This comment was minimized by the moderator on the site
=(A2-B2+(A2)) sem utilizar a multiplicação por 24
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations