I need to copy and paste the same information (in order), 1000 times into the same column. The data will run from 1990-2019, separated into quarters...
1990 FY1990 FQ11990 31-Jan-90 1
1990 FY1990 FQ21990 31-Jan-90 2
1990 FY1990 FQ31990 31-Jan-90 3
1990 FY1990 FQ41990 31-Jan-90 4
1990 FY1990 FQ11990 31-Jan-90 1
1990 FY1990 FQ21990 31-Jan-90 2
etc
etc
Is there a code I can write to automate this?
I believe you are mistaking, I believe the expected result is more like:
1990 FY1990 FQ11990 31-Jan-90 1
1990 FY1990 FQ21990 31-Jan-90 2
1990 FY1990 FQ31990 31-Jan-90 3
1990 FY1990 FQ41990 31-Jan-90 4
1991 FY1991 FQ11991 31-Jan-91 1
1991 FY1991 FQ21991 31-Jan-91 2
etc
etc
In order to do this, you should realise that your expected output looks like:
aaaa FYaaaa FQbaaaa 31-Jan-aa b
where:
aaaa
and aa
are the year, either in four digits or in two b
is the quarter number
What's the link between aaaa
and aa
? Simple: aa = MOD(aaaa,100)
.
From there you can start (realising that in Excel, concatenation is extremely simple: "TotalString" = "Total" & "String"
), so here we go (pseudo-code):
offset_number = 0
for aaaa = 1990 to 2019:
for b = 1 to 4:
resulting_string = aaaa & " FY" & aaaa & " FQ" & b & aaaa & " 31-Jan-" & MOD(aaaa,100) & " " & b
Starting_Cell.Offset(offset_number,0) = resulting_string
offset_number = offset_number + 1
Next b
Next aaaa
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.