A1 = 6-Dec
B1 = 2
Goal: Repeat all the dates 7 times starting from 6-Dec (Value in 'A1') up to 2 weeks (Value in 'B1')
Formula Used :
=ArrayFormula(FLATTEN( split( REPT(SEQUENCE(7,1,A1,1) SEQUENCE(1,B1,0,7)&"$",8),"$")))
Expected Result : Two columns for two weeks. Each date of the week to be repeated 8 times.
Actual Result : Only 1st week is repeated
Please help me in correcting the formula.
CodePudding user response:
=ARRAYFORMULA(A1 TRANSPOSE(SEQUENCE(B1,7*8,0)/8))
A1:
DateB1
: WeeksSEQUENCE
/TRANSPOSE
to create a sequence of numbers increasing in the vertical direction/8
Divide by8
to create 8 fractional numbers for the same number.- Add the fractional numbers to the date
A1
to create a date sequence repeated 8 times FLOOR
[optional] the fractional numbers, if exact dates are needed without time difference.
CodePudding user response:
use:
=INDEX(TEXT(FLATTEN(TEXT(SEQUENCE(7, 1, A1), SEQUENCE(1, 8,,))),
SEQUENCE(1, B1,,)) SEQUENCE(1, B1,, 7))