Forum Discussion

AlexMN1920's avatar
AlexMN1920
Copper Contributor
Nov 07, 2022
Solved

Finding difficult to find difference between AM and PM times

I have dataset with time recorded in AM/PM format. I am trying to find the duration by substracting from one from another. But it gives error when the time time overlaps to another day. 

 

Here is the link to the work book.

 

https://drive.google.com/file/d/1ygEjTenMBbHDh0furXEcLjHyWoGc_43k/view?usp=sharing

 

 

https://docs.google.com/spreadsheets/d/1bW8AaF-omVvhgnEoXwNcNcKoQh2MMKP4/edit?usp=sharing&ouid=109534421065634028463&rtpof=true&sd=true

5 Replies

      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        AlexMN1920 First you need to understand that times are in fact numbers. 11PM equals 23 hours into a 24-hour day. Thus, 23/24 = 0.958333

        The picture below is just an example of how that works. Look into the MS support pages for MOD function to see how that function works. I can't really describe it better myself.

        On row 4 you see the calculation in a Number format. The MOD function returns a positive number 0.083333. Multiply this number by 24 and you get 2 (hours). Or just format the number 0.083333 as Time to return 02:00.

         

         

    • AlexMN1920's avatar
      AlexMN1920
      Copper Contributor
      Wow!! That's amazing. Even after spending more than 30 minutes in Google, I din't find such short solution. Thank you!!!

Resources