0

I have been given an excel column with numbers and I want to create a new column with every cell content repeating 20 times and 20 dates sequentially next to it to another column.
How can I achieve this in excel or access?
For example I have a column with numbers as follows:

0491703316
0235361458
0380458968
0240510098
0169346827
0147826672

and I want to do this

0491703316 01/12/2016
0491703316 02/12/2016
0491703316 03/12/2016
0491703316 04/12/2016
......................
......................
0235361458 01/12/2016
0235361458 02/12/2016
0235361458 03/12/2016
0235361458 04/12/2016
........................
........................
........................
0380458968
0240510098
0169346827
0147826672

YowE3K
  • 23,852
  • 7
  • 26
  • 40
tkyo
  • 75
  • 1
  • 12

2 Answers2

1

Link the range in Access as a linked table named, say, LinkedTable.

Then create this query:

PARAMETERS 
    Period Text ( 255 ), 
    Periods Short, 
    FirstDate DateTime;
SELECT DISTINCT
    LinkedTable.Number, 
    10*Abs([Deca].[id] Mod 10)+Abs([Uno].[id] Mod 10)+1 As Sequence,
    DateAdd([Period],[Sequence]-1,[FirstDate]) AS [DateStart]
FROM 
    LinkedTable,
    MSysObjects AS Uno, 
    MSysObjects AS Deca
WHERE 
    10*Abs([Deca].[id] Mod 10)+Abs([Uno].[id] Mod 10)<[Periods]

Run this with the parameters:

Period: d
Periods: 20
FirstDate: 2016-12-01
Gustav
  • 53,498
  • 7
  • 29
  • 55
0

Assuming 0491703316 is in A1, in B8 enter 01/12/2016 and copy down to B28. Copy B8:B28 to B29. Select B8:B29 and drag down to B133. In A8 enter =A1 and in A9:

=IF(B9=B$8,INDEX(A:A,MATCH(A8,A:A,0)+1),A8)

Copy A9 down to suit.

pnuts
  • 58,317
  • 11
  • 87
  • 139