Time formula help

Kiwi den

Board Regular
Joined
Feb 17, 2014
Messages
153
Office Version
  1. 365
Platform
  1. Windows
I would like help with a formula to solve the following
Cell A:1 = 7:30am Cell A:2 = 14:00

I want Cell A:3 to equal cell A:2 - A:1 but if the time spans 12:00 to 12:30 then to deduct the 30 minutes from the total time in cell A:3

Your help appreciated
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Is the underlying cell value (regardless of display format) date and time ? OR time only ?
- test by putting this formula in a different cell =A1-1
- if the formula returns a cell full of hashtags (even if you widen the column), then A1 contains time only

This formula works for both
=IF(AND((A1-INT(A1))<=12/24,(A2-INT(A2))>=12.5/24),A2-A1-1/48,A2-A1)

This formula works where A1 & A2 contain time only
=IF(AND(A1<=12/24,A2>=12.5/24),A2-A1-1/48,A2-A1)

NOTE
The values in A1 & A2 are both assumed to belong to the same calendar day

There are other ways to to this- here is a link illustrating calculation of time differences
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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