CREATE A FORMULA

%3CLINGO-SUB%20id%3D%22lingo-sub-2061363%22%20slang%3D%22en-US%22%3ECREATE%20A%20FORMULA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2061363%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20it%20possible%20to%20write%20a%20formula%20to%20calculate%20the%20difference%20of%20two%20cells%20that%20have%20a%20time%20format%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2061363%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2061570%22%20slang%3D%22en-US%22%3ERe%3A%20CREATE%20A%20FORMULA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2061570%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F929289%22%20target%3D%22_blank%22%3E%40SRAMIREZ1026%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes.%20Let's%20say%20the%20start%20time%20is%20in%20A2%20and%20the%20end%20time%20is%20in%20B2.%3C%2FP%3E%0A%3CP%3EIn%20C2%2C%20enter%20the%20formula%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DB2-A1%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eand%20format%20C2%20as%20h%3Amm.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20want%20the%20difference%20in%20hours%2C%20use%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3D24*(B2-A2)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eand%20format%20C2%20as%20General%20or%20as%20Number.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20want%20the%20difference%20in%20minutes%2C%20use%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3D1440*(B2-A2)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eand%20format%20C2%20as%20General%20or%20as%20Number.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2071001%22%20slang%3D%22en-US%22%3ERe%3A%20CREATE%20A%20FORMULA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2071001%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3Ethank%20you%20for%20your%20help.%20It%20worked%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Is it possible to write a formula to calculate the difference of two cells that have a time format?

3 Replies

@SRAMIREZ1026 

Yes. Let's say the start time is in A2 and the end time is in B2.

In C2, enter the formula

 

=B2-A1

 

and format C2 as h:mm.

 

If you want the difference in hours, use

 

=24*(B2-A2)

 

and format C2 as General or as Number.

 

If you want the difference in minutes, use

 

=1440*(B2-A2)

 

and format C2 as General or as Number.

@Hans Vogelaarthank you for your help. It worked

@Hans Vogelaar 

A minor improvement for time intervals might be 

[h]:mm

since that will not lose values greater than a day from the display.