Auto-generate date and time for a large period.

Bilingual

Board Regular
Joined
Oct 1, 2010
Messages
186
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi, its probably a very simple question, but i want to generate to following values in the two columns:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Time[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]13[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]17[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]18[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]19[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]22[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]23[/TD]
[/TR]
[TR]
[TD]01-11-2016[/TD]
[TD]24[/TD]
[/TR]
[TR]
[TD]02-11-2016[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]etc[/TD]
[TD]etc[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

How do it without doing it manually? :)
 
Last edited:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I might have written it too complicated, the only thing i want is a new datecolumn to add 1 to the date for every 24 row.
 
Upvote 0
Enter one date manually in A2, then

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
2​
[/td][td]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
1​
[/td][td="bgcolor:#CCFFFF"]B2: =HOUR(A2)+1[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
2​
[/td][td="bgcolor:#CCFFCC"]A3: =MROUND(A2 + "1:00", "1:00")[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
4​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
3​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
5​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
4​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
5​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
6​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
8​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
7​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
9​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
8​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
10​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
9​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
11​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
10​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
12​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
11​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
13​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
12​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
14​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
13​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
15​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
14​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
16​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
15​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
17​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
16​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
18​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
17​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
19​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
18​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
20​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
19​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
21​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
20​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
22​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
21​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
23​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
22​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
24​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
23​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
25​
[/td][td="bgcolor:#CCFFCC"]
1/11/2016​
[/td][td="bgcolor:#CCFFFF"]
24​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
26​
[/td][td="bgcolor:#CCFFCC"]
1/12/2016​
[/td][td="bgcolor:#CCFFFF"]
1​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
27​
[/td][td="bgcolor:#CCFFCC"]
1/12/2016​
[/td][td="bgcolor:#CCFFFF"]
2​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
28​
[/td][td="bgcolor:#CCFFCC"]
1/12/2016​
[/td][td="bgcolor:#CCFFFF"]
3​
[/td][td][/td][/tr]
[/table]
 
Upvote 0
Here's a possibility. It depends on what you think "manual" is.

1. Start in cell A1. Enter your start date including hours and minutes; e.g., 2018-10-17 00:00.
2. Enter the following formula into A2: = A1 + 1/24. This should result with A2 showing the following value: 2018-10-17 01:00. It has been incremented by one hour since an hour is 1/24 of a day.
3. Drag the formula down to fill cells A3, A4, etc. Drag it as far as you need to to generate all the dates and hours that you need.
4. This may already bee accomplishing what you really need. But if you truly need to have the dates and times split into two columns then create formulas in cells B1 and C1 that accomplish this. I.e., in B1 use =DATE(YEAR(A1), MONTH(A1), DAY(A1)) and in C1 use = HOUR(A1).
5. Drag these formulas down as far as you need.
6. If you want the values rather than the formulas then copy and paste as values.
7. Of course, start in any cell that you want.

I hope this helps.
 
Last edited:
Upvote 0
Hi Dan, thanks for tries, i ended up solving it with a combination your advice and of INT,CEILING and MOD
=INT(A1)+CEILING(MOD($A1;1);1/24)
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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