I need help with this formula; I am not familiar with its syntax

kctony

New Member
Joined
Apr 14, 2017
Messages
25
Office Version
  1. 365
Platform
  1. Windows
I have come across this formula to convert time but am unfamiliar with the syntax.
Can someone help decipher this for me?
Thanx
=TEXT(MOD(TEXT(S2,"00\:00")-TEXT(J2,"00\:00"),1),"HHMM")+0
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
It's for calculating time difference when the times are entered as 4 digit numbers instead of proper times. For example 1615 instead of 16:15

The second and third text functions convert the number to a valid time. The subtraction calculates the difference.
MOD is used so that times which cross midnight are calculated correctly.
The final text function shows the result in the same 4 digit format instead of proper time format.
Adding 0 at the end converts that resulting text string to a proper number.
 
Upvote 0
It's for calculating time difference when the times are entered as 4 digit numbers instead of proper times. For example 1615 instead of 16:15

The second and third text functions convert the number to a valid time. The subtraction calculates the difference.
MOD is used so that times which cross midnight are calculated correctly.
The final text function shows the result in the same 4 digit format instead of proper time format.
Adding 0 at the end converts that resulting text string to a proper number.
Thank you, that was very helpful
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,320
Members
452,635
Latest member
laura12345

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