**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
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
what cell is what?
You have two "time difference" cells and zero date difference cells.
 
Upvote 0
hello awoohaw
I cannot add new cells to this for simplicity of use.
Cell to be modified is C12 and must take into account C7+C8 only if C7+C8 is above 132 (then add whatever extra value to C12 On top of what C12 is calculating by itself)
Hope it makes sense..
 
Upvote 0
no, how is the "extra value" calculated?
And what do you want if it doesn't exceed 132?

=IF(C7+C8>132,C12+WHAT,WHAT)?
 
Upvote 0
ok got you..
If it doesn't exceed 132 then C12 only does this: =(C2+C3)+264/24
If C7+C8 exceed 132 then the added result gets added to C12 (only what is above 132)
i.e if C7+C8 = 133hrs then 1hr is added to C12 (on top of C12 current formula)
Tricky part is to add this extra time and make it look like a Date & Time format.. if 25hrs are above 132 (=157hrs) then C12 should read 1 Day (calendar/date format) & 1 hour (time format) on top of what C12 is currently calculating.
Let me know if I make sense
 
Upvote 0
Are you just asking how to make the one calculation that adds extra time (days and hours) to the original date and time?
I sense that you are troubled with date/time calculations. They confuse me sometimes, too. But, I think you are over thinking it.
It seems that you have a starting date/time. Why break it up into two separate components of your formulas.
The date/time format of yyyy-mm-dd hh:mm:ss displays the time.
But in all of your discussions all I interpret is:

What is the new recommended date/time: If the elapsed time from Initial Date to Expected Date is less than 11 days (132 hours) add 11 days to the Initial Date, otherwise use the expected Date/time.

(you have various other dates, times, and adjustments in the worksheet, but they aren't used in the question above.


Book1
BC
19Initial Date Time2023-09-01 09:00:00
20Start Date/Time2023-09-06 21:08:00
21Elapsed Time132:08:00
22Expected Date/Time2023-09-06 21:08:00
23Expected Date/Time Rounded to nearest 15 min2023-09-06 21:15:00
Sheet1
Cell Formulas
RangeFormula
C21C21=C20-C19
C22C22=C19+IF(C21<(132/24),132/24,C21)
C23C23=MROUND(C19+IF(C21<(132/24),132/24,C21),15/(24*60))


I'm not really sure if this answers your question. If it doesn't, just tell what is your data is, and what do you want out of it. Add to that any conditions (like time zone adjustment) and how that affects your desired result.
 
Upvote 0
Since you did last fix for me I have not been able to finish this one..
I really appreciate your help with this and will try to explain what I would like to achieve.

In a practical situation, C2 & C3 are never changed.
C5 & C6 will not change either as they are given as a guide line taken from C2 & C3.

But C7 & C8 will be filled in by the user and sometimes can go over the recommended or expected time (C5 & C6).

In this situation, if C10 equals more than 132 then whatever the difference is from 132 to this result must be added to C17.
Which you did help me with last time.

All I need to do now is to adjust C12 Time Date format to take into account that time if any is added from 132
 
Upvote 0
I thought this thread is familiar, why have you created a different profile?
And your statments are spaghetti to me. I cannot follow.

I am pretty sure the formula I give in C23 is what you want.

C2 + C3 = this sum is not in a cell but combined is is a Date/Time, lets called it DateTime0
C5 and C6 I have no idea what role they play in this calculation.
C7 + C8 = this sum is not in a cell but combined is a Date/Time lets called it DateTime1
C9 Looks like you're adding a time adjustment to Time1, lets call this DateTime2
C10 You're rounding Time2 to the nearest 15 minutes, call this DateTime3
C12 You want to to add the Maximum of :
1. DateTime2 minus DateTime0​
2. 132/24 (11 Days)​
to DateTime0​

If that is right, I do that in the above, in C22 and C23, only the references are different..

I just don't know where in the formulas you want any rounding, as it is in some place and not in others
 
Last edited:
Upvote 0
take a loook at this, and tell me if the calculations here are what you want.
NOTE: I am not doing anything with the time zone adjustment or what ever you called it You have zeros in it in your work, so i'm ignoring it.

Book1
ABCDEFG
1
2
3DateTime0DateTime1time adjMinimum Expected Timeexpected datetime adjustmentexpected datetimeexpected datetime rounded
42023/09/01 09:00:002023/09/03 06:59:00132:00:005.52023/09/06 21:00:002023/09/06 21:00:00
52023/09/01 09:00:002023/09/03 12:41:00132:00:005.52023/09/06 21:00:002023/09/06 21:00:00
62023/09/01 09:00:002023/09/04 13:57:00132:00:005.52023/09/06 21:00:002023/09/06 21:00:00
72023/09/01 09:00:002023/09/05 17:02:00132:00:005.52023/09/06 21:00:002023/09/06 21:00:00
82023/09/01 09:00:002023/09/06 22:51:00132:00:005.5770833332023/09/06 22:51:002023/09/06 22:45:00
92023/09/01 09:00:002023/09/07 22:58:00132:00:006.5819444442023/09/07 22:58:002023/09/07 23:00:00
102023/09/01 09:00:002023/09/08 19:17:00132:00:007.4284722222023/09/08 19:17:002023/09/08 19:15:00
112023/09/01 09:00:002023/09/09 15:03:00132:00:008.2520833332023/09/09 15:03:002023/09/09 15:00:00
122023/09/01 09:00:002023/09/10 19:10:00132:00:009.4236111112023/09/10 19:10:002023/09/10 19:15:00
132023/09/01 09:00:002023/09/11 16:13:00132:00:0010.300694442023/09/11 16:13:002023/09/11 16:15:00
142023/09/01 09:00:002023/09/12 15:15:00132:00:0011.260416672023/09/12 15:15:002023/09/12 15:15:00
152023/09/01 09:00:002023/09/13 12:29:00132:00:0012.145138892023/09/13 12:29:002023/09/13 12:30:00
162023/09/01 09:00:002023/09/14 09:43:00132:00:0013.029861112023/09/14 09:43:002023/09/14 09:45:00
172023/09/01 09:00:002023/09/15 21:55:00132:00:0014.538194442023/09/15 21:55:002023/09/15 22:00:00
182023/09/01 09:00:002023/09/16 12:32:00132:00:0015.147222222023/09/16 12:32:002023/09/16 12:30:00
192023/09/01 09:00:002023/09/17 16:36:00132:00:0016.316666672023/09/17 16:36:002023/09/17 16:30:00
Sheet1
Cell Formulas
RangeFormula
D4:D19D4=132/24
E4:E19E4=MAX(B4-A4,D4)
F4:F19F4=A4+E4
G4:G19G4=MROUND(A4+E4,15/(24*60))
 
Upvote 0
Thanks for your help and apology for confusing description, I am struggling with that date-time thing..
I have used the same profile as last thread you helped me with.
I only need 1 cell formula to be adapted in C12, working in conjunction with current formula in same cell.
To make it simple,
What formula can be used to only add hours difference that exceed 132hrs from (C7+C8)-(C2+C3)
Cheers

NEW - D&T Formula Update.xlsx
ABCD
1
2Initial Date1/02/2024
3Initial Time9:00
41st Local Time Difference-1
5Expected Date & Time (TU)6/02/2024 9:00
6Recommended Date & Time (TU)6/02/2024 8:00
7Actual Start Date (TU)7/02/2024
8Actual Start Time (TU)22:00
9Start Original Date & Time (TU)7/02/2024 23:00
10Hours Since Initial (120 +/-12hrs)158:00
112nd Local Time Difference-3
12Expected Date & Time (V)12/02/2024 9: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)12/02/2024 6:00
14Actual Start Date (V)12/02/2024
15Actual Start Time (V)9:00
16Start Time (V)12/02/2024 12:00
17Total Time from Initial (Min 264hrs)293:00
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
C4List=Sheet2!$B$2:$B$14
C11List=Sheet2!$B$2:$B$14
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,984
Members
449,092
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