**Add existing date & time to another cell with condition**

psc1

New Member
Joined
Nov 27, 2011
Messages
32
Office Version
  1. 2010
Hello
Would one of you genius out there please help me out with a formula?
There is one cell that needs to change its Date & Time based on the value of a previous one.
But it only needs to add the date & time difference between those 2 cells IF result is above 132hrs (only add whatever is above 132hrs)
Hopefully someone can work it out.
Cheers

NEW - D&T Formula Update.xlsx
ABCDEFGH
1
2Initial Date1/09/2023
3Initial Time9:00
41st Local Time Difference0
5Expected Date & Time (TU)6/09/2023 9:00
6Recommended Date & Time (TU)6/09/2023 9:00
7Actual Start Date (TU)6/09/2023
8Actual Start Time (TU)21:08
9Start Original Date & Time (TU)6/09/2023 21:08
10Hours Since Initial (120 +/-12hrs)132:15
112nd Local Time Difference0
12Expected Date & Time (V)12/09/2023 9:00<<<- How to add date & time difference to this cell only if C7+C8>132hrs (only for the time above 132hrs)
13Recommended Start Date & Time (V)12/09/2023 9:00/ would something like this work? =(C2+C3)+264/24+IF(C7+C8)>=132/24
14Actual Start Date (V)12/09/2023
15Actual Start Time (V)9:00
16Start Time (V)12/09/2023 9:00
17Total Time from Initial (Min 264hrs)264:15
18
Sheet1
Cell Formulas
RangeFormula
C5C5=(C2+C3)+120/24
C6,C13C6=C5+(C4/24)
C9,C16C9=(C7+C8)-(C4/24)
C10C10=MROUND(C9-(C2+C3),15/(60*24))
C12C12=(C2+C3)+264/24
C17C17=MROUND(C16-(C2+C3)+IF(C10>=(132/24),C10-132/24,0),15/(60*24))
Cells with Data Validation
CellAllowCriteria
F3List=Sheet2!$B$4:$B$12
F6List=Sheet2!$B$4:$B$12
C4List=Sheet2!$B$2:$B$14
C11List=Sheet2!$B$2:$B$14
 
I am pretty sure i have done what you asked in my earlier posts.

can you write an example:
I have a starting date and time of ____________________________.
There is another datetime of ______________________________________.
If the difference of hours between those dates is greater than ______________________________hours,
then add ______________________________________________ hours to this ____________________________________datetime.
If not, add _____________________________________________hours to this ___________________________________datetime.

And if you want to include the time zone difference, please explain how that adjusts the end date/time result? Is only changed at the last formula?

and just curious: Why do you have two different local time differences? Is this for Time Zones?
 
Last edited:
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Thank you for your patience and for taking the time to understand ;)

I have a starting date and time of _____01/02/24 @ 0900_____(C2+C3)__________________.
There is another datetime of __________07/02/24 @ 2200_____(C7+C8)______________________.
If the difference of hours between those dates is greater than ______132hrs (C10)________________________hours,
then add ___________26hrs (158-132 or (C7+C8)-(C2+C3)___________________________________ hours to this ______12/02/24 @ 0900 (C12)_________________datetime.
If not, add ___________0hrs_____(just use the current =(C2+C3)+264/24 formula_________________hours to this _________C12__________________________datetime.
 
Upvote 0
and just curious: Why do you have two different local time differences? Is this for Time Zones?
This formula is not for time zones, Time zones are calculated only for C6 & C13 cells.
Time zones are important since at the time a task is done on a ship, the time from departure is not the same since the ship is moving through time zones
 
Upvote 0
add ___________0hrs_____(just use the current =(C2+C3)+264/24 formula_________________hours to this _________C12__________________________datetime
this makes no sense: C2+C3 is a date time value of 45323.375
264/24 has a value of 11​
C12 has a date time value of 45334.375​
So you want a date another 124 years in the future???​

DId you look at the calculations of various dates in Post #10????

Look at what is purple below:

Book1
ABCD
1
2Initial Date2024-02-01
3Initial Time09:00:00
41st Local Time Difference-1. Hours
5Expected Date & Time (TU)2024-02-06 09:00:00
6Recommended Date & Time (TU)2024-02-06 08:00:00
7Actual Start Date (TU)2024-02-07
8Actual Start Time (TU)22:00:002024-02-07 22:00:00
9Start Original Date & Time (TU)2024-02-07 23:00:00^^^^^^ is the same as ^^^^^^^^^
10Hours Since Initial (120 +/-12hrs)158:00:002024-02-07 22:00:00
112nd Local Time Difference-3. Hours^^^^^^^^
12Expected Date & Time (V)2024-02-12 09:00:00<<<- How to add hours difference (in date & time format) between (C7+C8)-(C2+C3)>132hrs (but only if this number is greater than 132)
13Recommended Start Date & Time (V)2024-02-12 06:00:00
14Actual Start Date (V)2024-02-12
15Actual Start Time (V)09:00:00
16Start Time (V)2024-02-12 12:00:00
17Total Time from Initial (Min 264hrs)293:00:00
Sheet2
Cell Formulas
RangeFormula
C5C5=(C2+C3)+120/24
C6,C13C6=C5+(C4/24)
D8D8=MAX((C7+C8),(132/24))
C9,C16C9=(C7+C8)-(C4/24)
C10C10=MROUND(C9-(C2+C3),15/(60*24))
D10D10=IF((C7+C8)-(C2+C3)>(132/24),(C7+C8),(132/24))
C12C12=(C2+C3)+264/24
C17C17=MROUND(C16-(C2+C3)+IF(C10>=(132/24),C10-132/24,0),15/(60*24))

 
Upvote 0
You are correct, my bad.. C12 currently adds 264hrs or 11 days from C2+C3
So I'm trying to understand.
Can I combine current formula and the one you just made inside C12:
Something like this?
=((C2+C3)+264/24)+(IF((C7+C8)-(C2+C3)>(132/24),(C7+C8),(132/24)))
and this will add the difference in time from (C7+C8)-(C2-C3) only if above 132hrs?
 
Upvote 0
Look at what I did in purple. And the calculation sheet in POST #10 9.
If it is wrong tell me what is wrong, and what is expected.

I"m really not going to answer any more questions from you until you answer.

After that i'll look at the time difference question.
 
Upvote 0
Fair enough and thank you for your time.
I will put my head around those and get back to you.
Thanks again
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,987
Members
449,093
Latest member
Mr Hughes

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