Advance date after midnight

l1011driver

Board Regular
Joined
Dec 26, 2014
Messages
68
Office Version
  1. 365
Platform
  1. Windows
Thank you in advance to anyone who might have a suggestion.

I have a spreadsheet that has time in 1 minute increments. In an adjacent column I have a date corresponding to each 1-minute increment of time.

What I would like to do is have the date cell advance to the next day when the corresponding time cell reaches midnight (00:00). Subsequent date cells would reflect the "new" date until again reaching midnight on that day.

If you have any suggestions or help I'd be grateful. It seems my laptop doesn't like XL2BB so I'll attach a screen shot of what I'm talking about. I use a formula for time in column C, but column B is just the date copied to each subsequent cell. The formula bar shows the formula I use for the 1-minute increments of time.

Thank you for any help.

Sincerely,

L1011driver
 

Attachments

  • Screenshot (25).png
    Screenshot (25).png
    80.8 KB · Views: 15
Try adding these formulas to cells B7 and C7 and copying down:

B7:
Excel Formula:
=IF(ROW()=7,$C$4,IF(INT(C7)=INT(C6),B6,B6+1))

C7:
Excel Formula:
=IF(ROW()=7,C5+(1/1440),C6+(1/1440))
When I try to drag the formula it gives me a circular reference warning.

It's getting pretty late on my side of the world. I'm going to regroup and try again tomorrow.

Thank you so much for your help and patience. I apologize for my lack of proficiency.
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
My effort:
Book1
BC
4Start Date:18/05/2023
5Start Time:23:50
6Minutes to run:20
7
8DateTime
918/05/202323:51:00
1018/05/202323:52:00
1118/05/202323:53:00
1218/05/202323:54:00
1318/05/202323:55:00
1418/05/202323:56:00
1518/05/202323:57:00
1618/05/202323:58:00
1718/05/202323:59:00
1819/05/202300:00:00
1919/05/202300:01:00
2019/05/202300:02:00
2119/05/202300:03:00
2219/05/202300:04:00
2319/05/202300:05:00
2419/05/202300:06:00
2519/05/202300:07:00
2619/05/202300:08:00
2719/05/202300:09:00
2819/05/202300:10:00
Sheet1
Cell Formulas
RangeFormula
B9:C28B9=LET( t,C5+TIME(0,SEQUENCE(C6),0), d,SCAN(C4,t,LAMBDA(a,x,IF(x=1,a+1,a))), HSTACK(d,t))
Dynamic array formulas.
HI George,

It's getting late here on my side of the world. I'll work on it more tomorrow.

Thank you so much for your help and patience.

Take care and stay safe.

Yours,

Mark
 
Upvote 0
When I try to drag the formula it gives me a circular reference warning.

It's getting pretty late on my side of the world. I'm going to regroup and try again tomorrow.

Thank you so much for your help and patience. I apologize for my lack of proficiency.
Sounds like you may have put the formulas in the wrong cells.
Note that the way I wrote them is for cells B7 and C7.
If you are putting them in any other cell to start, you may need to adjust the formula accordingly.
 
Upvote 0
I'm thinking you are absolutely correct. I'm positive the problem is in my incorrect entry of your formulas. As such I'm attaching an image of a portion of the actual spreadsheet I'm using. I hope this helps. We can put your cell references in their proper place and it should work fine. The example you gave me represents exactly what I want to do.

My wife and I are on the road today, but we'll arrive at our destination this evening local Thailand time. I'll be available after that for several days.

Thank you again for your help.

Sincerely,

Mark
 

Attachments

  • Screenshot (26).png
    Screenshot (26).png
    72.5 KB · Views: 7
Upvote 0
With that layout, the formula I suggested would be
Fluff.xlsm
ABCDE
1
2121/12/202323:56:00
3221/12/202323:57:00
4321/12/202323:58:00
5421/12/202323:59:00
6522/12/202300:00:00
721/12/2023622/12/202300:01:00
823:55722/12/202300:02:00
9822/12/202300:03:00
10922/12/202300:04:00
111022/12/202300:05:00
121122/12/202300:06:00
13
Sheet4
Cell Formulas
RangeFormula
C2:C12C2=SEQUENCE(11)
D2:D12D2=INT(B7+B8+TIME(0,SEQUENCE(11),0))
E2:E12E2=B8+TIME(0,SEQUENCE(11),0)
Dynamic array formulas.
 
Upvote 0
Solution
Hi Fluff,

Your suggestion absolutely did the trick. It's working exactly like I wanted it to!

I wouldn't have come up with your Excel functions in a million years. Same can be said for Georgiboy and Joe4's solutions as well. I will research exactly how the functions you provided work. Just when I think I'm starting to get pretty good at Excel I realize how very little of it I actually know.

Many thanks to you, Georgiboy and Joe4 for all your help! I sincerely appreciate it!

Take care and stay safe.

Yours,

Mark
 
Upvote 0
Hi Fluff,

Your suggestion absolutely did the trick. It's working exactly like I wanted it to!
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,432
Messages
6,124,860
Members
449,194
Latest member
HellScout

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